如何标记视频播放器从其他应用程序打开的视频文件? [英] How to tag video player for opening video files from other apps?
问题描述
我写了一个vidoeplayer,并想知道...当你从其他应用程序点击一个视频文件,说一个文件浏览器,显示应用程序的列表,可以打开该视频文件。
I wrote a vidoeplayer and was wondering... when you click a video file from some other app, say a file browser, a list of apps appear, that can open this video file.
如何让我的球员也出现在名单上?
How do I make my player also appear on that list?
谢谢!
推荐答案
您必须注册意图
你想要在你的活动。
You have to register the Intent
you want in your activity.
这是API 15,你需要添加 CATEGORY_APP_MUSIC 以您的应用程序清单,或许是受 ACTION_MAIN 的意图过滤器。
From API 15, you need to add CATEGORY_APP_MUSIC to your app manifest, possibly under ACTION_MAIN intent filter.
如果您要定位到API 8,也可以使用<一个href="http://developer.android.com/reference/android/provider/MediaStore.html#INTENT_ACTION_MUSIC_PLAYER"相对=nofollow>的意图过滤器INTENT_ACTION_MUSIC_PLAYER 。 下面是一个示例清单的部分。
If you want to target down to API 8, also use INTENT_ACTION_MUSIC_PLAYER in the intent filter. Here's a sample manifest part..
<activity android:name=".ui.MyActivity" >
<intent-filter>
<category android:name="android.intent.action.MAIN" /> <!-- If this is the main activity -->
<action android:name="android.intent.action.MUSIC_PLAYER" />
<action android:name="android.intent.category.APP_MUSIC" />
<data android:mimeType="video/*" /> <!-- To make sure we let Android know that we accept video -->
</intent-filter>
</activity>
希望这有助于。
Hope this helps.
这篇关于如何标记视频播放器从其他应用程序打开的视频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!