如何让用户能够使用我的应用播放视频? [英] How can I enable users to play video using my app?
问题描述
昨晚刚刚花了几个小时为 Honeycomb 开发了一个非常棒的视频播放器,现在我当然希望人们能够使用它.
Just spent a couple of hours last night developing a pretty sweet video player for Honeycomb, and now I'd of course love for people to be able to use it.
如何让我的应用程序侦听/接收视频播放广播"?
How can I make my application listen for / receive "video play broadcasts"?
我猜它与 manifest.xml
文件有关,但我在 Android 开发者网站上找不到任何关于它的信息.
I'm guessing it's got something to do with the manifest.xml
file, but I was unable to find anything about it on the Android Developer site.
我尝试使用以下方法但没有取得多大成功:
I've tried using the following without much success:
<receiver android:name=".VideoPlayer">
<intent-filter>
<action android:name="android.intent.action.VIEW">
<data android:mimeType="video/*" />
</action>
</intent-filter>
</receiver>
推荐答案
我最终在我的 manifest.xml
文件中使用以下代码自己解决了这个问题:
I eventually solved this one myself with the following code in my manifest.xml
file:
<!-- Video player -->
<activity android:name=".VideoPlayer" android:label="@string/app_name"
android:theme="@style/BlackHolo" android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="rtsp" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
<data android:mimeType="application/sdp" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:mimeType="video/*" />
</intent-filter>
</activity>
这篇关于如何让用户能够使用我的应用播放视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!