-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[video_player_android] Add RTSP support (#7081)
Add RTSP support to `DataSourceType.network` videos on Android platform. I'm using this patch on my projects and it works well, but I need some feedback if the approach used is correct. If so, I will continue writing the tests. This PR implements the Android part of this feature request: flutter/flutter#18061 . I added a RTSP tab on the example app: https://github.com/flutter/packages/assets/7874200/9f0addb1-f6bb-4ec6-b8ad-e889f7d8b154
- Loading branch information
Showing
10 changed files
with
171 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 2.6.0 | ||
|
||
* Adds RTSP support. | ||
|
||
## 2.5.4 | ||
|
||
* Updates Media3-ExoPlayer to 1.4.0. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...o_player_android/android/src/main/java/io/flutter/plugins/videoplayer/RtspVideoAsset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.videoplayer; | ||
|
||
import android.content.Context; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.OptIn; | ||
import androidx.media3.common.MediaItem; | ||
import androidx.media3.common.util.UnstableApi; | ||
import androidx.media3.exoplayer.rtsp.RtspMediaSource; | ||
import androidx.media3.exoplayer.source.MediaSource; | ||
|
||
final class RtspVideoAsset extends VideoAsset { | ||
RtspVideoAsset(@NonNull String assetUrl) { | ||
super(assetUrl); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
MediaItem getMediaItem() { | ||
return new MediaItem.Builder().setUri(assetUrl).build(); | ||
} | ||
|
||
// TODO: Migrate to stable API, see https://github.com/flutter/flutter/issues/147039. | ||
@OptIn(markerClass = UnstableApi.class) | ||
@Override | ||
MediaSource.Factory getMediaSourceFactory(Context context) { | ||
return new RtspMediaSource.Factory(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters