Hafiz
Hafiz

Reputation: 23

I want my application's user to play every video with MyVideoPLayer

I had developed a video player which is working fine. Now i want from user to play every song with it. I mean whenever user clicks a video file, it should play with my video player or how can I add my video player to the alert dialog which appears when a video file is clicked?

Upvotes: 0

Views: 124

Answers (1)

Raghav Sood
Raghav Sood

Reputation: 82553

Add the following intent-filters to your video player activity:

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

This will add your app to the list of apps that can play Videos and RTSP streams from the internet (remove the first filter if you don't want to support streaming).

Upvotes: 1

Related Questions