You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[video_player_android] Platform view support (#8466)
This PR adds support for platform views on Android as a way of displaying a video. When creating a video, it's now possible to choose between texture view approach (rendered using `Texture` widget on the Flutter side) and platform view approach (rendered on the native side, using `SurfaceView`).
`VideoPlayer` class now has nothing to do with texture. The texture-related code was moved from it to `TextureVideoPlayer` - a subclass of `VideoPlayer` that adds texture functionality. There's also `PlatformViewVideoPlayer` - a subclass of `VideoPlayer` that adds platform view functionality. In the plugin class (`create` method) we create either the platform view version or the texture version based on the parameter (`viewType`) passed in from Flutter side.
The functionality is not yet exposed in the app-facing package (only in the example app) - it will be done in a separate PR. The PR does not introduce breaking changes.
Related issues:
- [#86613](flutter/flutter#86613) - this issue requests platform view support for iOS. Here we also add it for the Android, so that it works on both mobile platforms.
Copy file name to clipboardExpand all lines: packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/ExoPlayerEventListener.java
Copy file name to clipboardExpand all lines: packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/ExoPlayerState.java
+9-7Lines changed: 9 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
5
5
packageio.flutter.plugins.videoplayer;
6
6
7
+
importandroidx.annotation.NonNull;
7
8
importandroidx.media3.common.PlaybackParameters;
8
9
importandroidx.media3.exoplayer.ExoPlayer;
9
10
@@ -15,7 +16,7 @@
15
16
* is reclaimed. Upon <em>resume</em>, the player will need to be recreated, but start again at the
16
17
* previous point (and settings).
17
18
*/
18
-
finalclassExoPlayerState {
19
+
publicfinalclassExoPlayerState {
19
20
/**
20
21
* Saves a representation of the current state of the player at the current point in time.
21
22
*
@@ -24,12 +25,13 @@ final class ExoPlayerState {
24
25
* @param exoPlayer the active player instance.
25
26
* @return an opaque object representing the state.
Copy file name to clipboardExpand all lines: packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/HttpVideoAsset.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ final class HttpVideoAsset extends VideoAsset {
Copy file name to clipboardExpand all lines: packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/LocalVideoAsset.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -17,12 +17,13 @@ final class LocalVideoAsset extends VideoAsset {
0 commit comments