Posts Tagged ‘android’

Does html5 video work in Android?

Wednesday, April 7th, 2010

In the interest of finding the right answer by posting (possibly) incorrect information, here goes.

Transcode an H.264 video to something that works great on the ipad/iphone: video: avc1, 29.97 fps, 380 kbps, 480 x 370 Audio: mp4a, 44 kHz, 64 kbps

Put together a page and view it on the iphone/ipad:


<!DOCTYPE html>
<html><head><title>html5 test</title></head><body>
<video id="movie" width="480" height="370" poster="http://example.com/still.jpg" controls>
<source src="http://example.com/video.mp4" type="video/mp4">
Your browser does not support html5 video.
</video>
</body></html>

View it on the iphone/ipad – wonderful html5 video plays.

View it on Android 1.6 (G1) – Nope, get “Your browser does not support html5 video”.
View it on Android 2.1 (Nexus One) – See the poster image, and if you add the onclick hack below the video will play in the media player.
View it on Android 2.2 (Nexus One) – See the poster image, but clicking the poster does nothing, cannot view video.

When will Android support html5 video?

Update:
Found a message from Dan Morrill html5 video is not supported at this time in the browser.

Update 2:
Some people have found some level of success by adding onclick="this.play();" to the <video> tag, but this doesn’t always work, for instance it used to work with Android 2.1 on the Nexus One, but since upgrading to Android 2.2 it no longer works.

Android Owner application in the market

Friday, November 7th, 2008

Windows mobile has an “Owner Information” section you can enable on the today screen.  This is useful if you leave your device behind somewhere and someone else picks it up.  Strangely, the T-Mobile Android G1 phone does not have something like this.

I created an application named “Owner”, which you can download from the android market as “Factory-H Owner”, which somewhat fills in the missing functionality.  Many users are quick to point out that you have to get past the ‘lock screen’ to run the Owner application.  Unfortunately the api for modifying the lock screen is not released yet, but once it is, the Owner application will be updated to accomodate this functionality.

One thing to remember, Android is not just the G1 phone – it will run on many devices in the future.  One place the “owner information” is very useful is on wireless scanners (which are not phones), so entering the owner information is nice if you have a scanner assigned to someone, and they leave it somewhere.

A possible feature for the Owner application is to have it sync the System.Settings.ANDROID_ID with a service on the internet.  If I did this, you could potentially login to the service, and mark your device as ‘stolen’, then the app could check with the service and possibly phone home with it’s GPS location.  Would users be interested in this functionality?

Debugging Android with emacs

Thursday, November 6th, 2008

When I last did serious java development, the eclipse ide hadn’t come on the scene. VisualAge was so buggy it crashed all the time, so I gave up on java ide’s altogether and got emacs with etags to the point that it didn’t matter. Coming from a C/C++ background, I was used to running gdb in a shell in emacs, so that is what I did with jdb at that time.

Things are different now. Eclipse seems like it might be a good ide, but I’ve never tried it. I like emacs, because I’m quicker in emacs since I know the key combinations, plus having written up lots of lisp over the years to make life easier. Note, there’s something called jde out there for emacs, which makes it into a full fledged ide – but there’s a lot of install work to get it working. I’m not about to bother with that, because I just don’t have the time.

Here’s the purpose of this article – how do you debug android applications using emacs? I did it like this on my macbook:

1. install the android sdk ($SDK)
2. put $SDK/tools on your $PATH
3. Create a new android app in $WORKING like this: activitycreator –out projname com.yourdomain.appname.YourActivity
4. Build the app with ant (you already have ant installed, right?): ant
5. Run the android emulator: emulator &
6. Run the debugging service: ddms &
7. Install your app in the emulator: ant install
8. In your .emacs file, make sure you have gud-jdb-sourcepath and gud-jdb-classpath set to your working directory src and bin/classes folders. This could be a pain if you have to change working directories a lot – but I don’t, and I’m just getting started with java development after being out of it for a long time, so if there is a better way, please let me know what it is.

(custom-set-variables
'(gud-jdb-use-classpath t)
'(gud-jdb-classpath "$WORKING/src:$WORKING/bin/classes")
'(gud-jdb-sourcepath "$WORKING/src")
'(gud-pdb-command-name "~/bin/pdb.py"))

9. Now you can launch your app in the emulator. If you look at the ddms window, you’ll see a line for the process with the column on the right being the port number for the debugger to connect. In this picture it is 8607.

ddms window

10. In emacs, C-x jdb RET and you will see: jdb. Fill in the rest of the line like this, note, no space between sourcepath and the path:
jdb -sourcepath$WORKING/src -attach localhost:8607
11. Set a breakpoint in the source file with C-x SPACE and you’ll hit it when you come around.

Note, you’ll have to fill in the $WORKING yourself, and if you don’t know jdb, I suggest you read the fine manual.

Have fun debugging.