Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I enable users to play video using my app?

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"?

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>
like image 902
Michell Bak Avatar asked Dec 21 '22 09:12

Michell Bak


1 Answers

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>
like image 93
Michell Bak Avatar answered Dec 28 '22 10:12

Michell Bak