8

I am trying to stream video (or use progressive download) to a Motorola Droid Browser and am not having a lot of luck. With my iPhone, I can direct Safari to http://xxx.xxx.xxx/FileName.mp4 (which is an MPEG-4 video file), and Safari opens quicktime, and the video plays. However, with the Droid, I go to the same web address and am faced with a error stating "Cannot play video.... Sorry, this video is not valid for streaming to this device".

When I direct the Droid's browser to a WMV file, it will fully download the video file and then play it in what appears to be the Droid video player if I click on it.

Ideally, I'd like to replicate the behavior of the iPhone on the Droid, where the video player pops up and the video starts before the complete download. Video format isn't an issue, as I can encode the video to pretty much any standard. I was trying the .mp4 file because the Droid documentation says that it supports MPEG-4 video, although I can't get it to work from the browser.

Any insight would be much appreciate.

TheJerkMan24
  • 252
  • 4
  • 9

4 Answers4

1

You should launch an intent and set the type to "video/*" so that it opens directly with a video player instead of the browser.

Error 454
  • 7,063
  • 2
  • 30
  • 46
1

Streaming in Android is a pain in the ass. The best option is to stream the video with RTSP protocol.

If your Droid is updated to 2.2 you can also set up a simple webpage with an embedded Flash player like jwplayer (don't forget to set up alternate content when Flash player is not installed on the device so the user can download it from Adobe).

I successfully deployed both solutions. RTSP for <2.1 and embedded Flash player playing video from RTMP stream (you can also play local file from the server)

Note that in some devices (Hero) you can't embed the WebView with the Flash player inside your app.

If you look for a fast solution I would give a try to 3gp.

Also, when connectivity is not fast enough to play the video you will get that same error you posted (even with properly encoded videos).

EDIT: I used H.264 on RTSP streams and VP6 on RTMP. VP8 is supported by newer devices only.

momo
  • 3,192
  • 6
  • 33
  • 62
  • could you please share on how you used rtmp in android ?? i mean using what library ? and all ? – Rat-a-tat-a-tat Ratatouille Mar 24 '14 at 10:32
  • This was long time ago, so maybe it has better support now. What I did for RTMP was to have a extremely simple HTML page that only contained a embedded JWPlayer (This was a workaround because in many devices the RTMP stream just wouldn't play when opened as a video stream link, as when you just open a RTSP link with an intent). On the server side we used Wowza for streaming the video. I would recommend you to do your initial tests with a simple encoded video (maybe a mpeg1 or 2) so you are sure that the streaming works, because there are a lot of codecs which are not supported by many devices – momo Mar 26 '14 at 03:13
  • is the JWPlayer open source ? i mean i have seen many codes that use it , but i am not really aware as to what it is, an open source library or what ?yes true some codecs are not supported on some devices :( . N thanks too for your response – Rat-a-tat-a-tat Ratatouille Mar 26 '14 at 04:02
  • Check http://www.jwplayer.com/license/ I guess you could try another player, just telling you what I used when I did it. Good luck – momo Mar 26 '14 at 06:27
  • thank u :).. and just to confirm , flash is not required as a plugin is it?? If not, it would be great trying this :).. thanks a lot for your help – Rat-a-tat-a-tat Ratatouille Mar 26 '14 at 06:29
  • It is not required as most devices have it in embedded in the stock ROM. A little before I did this (around 2011) Flash plugin was able to be installed in the devices missing it with the standard web link (getflash or something like that), but at the time that was discontinued. If I were you, and could choose, I would use RTSP for the older devices and Apple HTTP Live Streaming for the newer ones (I believe since Android 3.0). Sorry I can't be of more help on this – momo Mar 26 '14 at 12:37
  • yes rtsp works well but the live videos have rtmp support so i cant change that much :).. thnks for the help :) – Rat-a-tat-a-tat Ratatouille Mar 26 '14 at 12:45
0

I am not entirely sure about this but I don't think it's really possible.

As far as I know "supported" only means it can play it out of the box, but there are no plugins for the browser so it doesn't know that to do with it.

If you want to validate if Android can play the file, put it on the SD card and play it through the Gallery.

Jonas Van der Aa
  • 1,392
  • 10
  • 26
0

Playing a mp4 file from the browser is supported. If you have a particular link that is not working, please post the link. Also, it would be helpful to see what "adb logcat" shows.

user287989
  • 19
  • 1