开发者

Streaming Video (or Progressive Download) to the Droid Browser

开发者 https://www.devze.com 2022-12-17 16:33 出处:网络
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 c开发者_开发知识库an direct Safari to http://xxx.xxx.xxx/FileNam

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 c开发者_开发知识库an 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.


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


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消