There is a lot of information on the Internet about how to play a video, but I still haven’t found how to make the player play the address of the video file transmitted to it at the start, or, for example, when you click the play button in the browser, on what video, your player got this video. Please tell me the resource or solution.

    1 answer 1

    Register in the manifest something like this:

    <activity android:name="com.example.player.MainPlayerActivity"> <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:mimeType="video/*" /> <data android:mimeType="application/mp4*" /> <data android:mimeType="application/mpeg*" /> <data android:pathPattern=".*mpg" /> <data android:pathPattern=".*MPG" /> <data android:pathPattern=".*mpeg" /> <data android:pathPattern=".*MPEG" /> <data android:pathPattern=".*avi" /> <data android:pathPattern=".*AVI" /> <data android:pathPattern=".*mp4" /> <data android:pathPattern=".*MP4" /> </intent-filter> </activity> 

    And you will catch this activity intents on playing videos in the specified formats.

    • Vseravno there is a problem with the fact that, for example, chrome launches a built-in videobar. It turns out that the redirect from the mobile browser does not work. Is the script possible, if you open the same chrome using the startActivityForResult method and, after tapping the Play button in the same browser, transfer the video resource to your application? - Vitaly Shimko
    • Well, as chrome does when clicking on a video, he alone knows. If he does not call Intent with any Action, then it cannot be intercepted. - xkor