播放视频文件的最佳方式吗? [英] Best way to play a Video file?

查看:258
本文介绍了播放视频文件的最佳方式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个视频文件的URL,我需要使用手机的本地视频播放器上播放。结果
我想用 Intent.ACTION_VIEW ,并设置URI作为意向数据,我能够实现对G1上述除HTC英雄。在英雄的情况下,我必须明确地设置类名称的意图开始默认的视频播放器: intent.setClassName(com.htc.album,com.htc.album.ViewVideo );

不过,我不舒服使用这种方法,因为它可能会在其他Android设备打破。请指点上:结果
1.什么是打通过这个意向视频网址的最佳途径,不论手机?结果
2.如何有条件地setClassName在意向,具体到手机?

请注意:写一个独立的视频播放器为我们的应用程序是不是我们就可以在瞬间承受的选项

谢谢!


解决方案

  

请注意:写一个独立的视频
  球员为我们的应用程序是不是一种选择,我们
  可以在瞬间承受的。


首先,视频播放器<一个href=\"http://www.google.de/interstitial?url=http%3A//www.androidguys.com/2009/12/14/$c$c-pollution-reaching-past-the-sdk/\">not该SDK 的一部分,依赖于它是一个很大的错误,因为你已经发现了。

二,创建一个简单的视频播放器大约需要 code的40行,你已经花了更多的时间试图避免写code的那些40行,它会采取只写线摆在首位。

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 conditionally 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.

这篇关于播放视频文件的最佳方式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆