Android Remote Video with Titanium

♀尐吖头ヾ 提交于 2020-01-14 08:27:30

问题


Greetings all!

I'm trying to play a video that is hosted on our webserver on an android phone. I've already built this for iPhone and it works great.

Droid, however is a different issue. Instead of getting video, I'm just getting a black screen, no error or anything.

The code I am using is:

activeContent = Titanium.Media.createVideoPlayer({ contentURL: content, backgroundColor:'#111', movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT });

win.add(activeContent); activeContent.play();

The video I'm downloading does play on the droid when not using Titanium, so I know its not a format issue. (its an .MP4 incase anyone is wondering.)

I've used Titanium SDK's 1.5.1 and am on the continuous build of 1.6.0 from earlier today.

using the 2.2 Droid SDK, and Titanium Developer 1.2.2

Does anyone have any thoughts on this? One of the big selling points for android is its ability to pull media from the net, and I'm honestly a little concerned about this shortcoming if its an issue with Titanium.


回答1:


For Android, the video player should not be added to the window. Android will open its video player in a new window when you call play(). So your code should instead look like this:

activeContent = Titanium.Media.createVideoPlayer({ contentURL: content, backgroundColor:'#111', movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT });

activeContent.play();

Blessings!




回答2:


In 1.6.1 kitchen sink Android is able to play a local video, but not remote videos. I've gotten my video playing to work in iPhone but not in Android.



来源:https://stackoverflow.com/questions/4550557/android-remote-video-with-titanium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!