开发者

Best way to play a Video file?

开发者 https://www.devze.com 2022-12-16 19:31 出处:网络
I have a URL for a video file which I need to play using the native Video-player of the handset. I figured using Intent.ACTION_VIEW and setting the URI as Intent data, I am able to achieve the aforeme

I have a URL for a video file which I need to play using the native Video-player of the handset.

I figured using Intent.ACTION_VIEW and setting the URI as Intent data, I am able to achieve the aforementioned on G1 except HTC hero. In case of Hero, I have to explicitly set the class Name in the Intent to start the default Video Player: intent.setClassName("com.htc.album","com.htc.album.ViewVideo");

However, I am not comfortable with this approach as it might break on other Android devices. Please advice on :

1. What would be the best way to play this video url via Intent, irrespective of the handset?

2. How to conditiona开发者_StackOverflowlly setClassName in Intent, specific to a Handset?

Note: Writing a standalone Video Player for our app is NOT an option we can afford at the moment.

Thanks!


Note: Writing a standalone Video Player for our app is NOT an option we can afford at the moment.

First, the video player is not part of the SDK, and relying upon it is a big mistake, as you have already discovered.

Second, creating a simple video player takes about 40 lines of code, and you have already spent more time trying to avoid writing those 40 lines of code that it would have taken just to write the lines in the first place.

0

精彩评论

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