Created
March 6, 2024 22:10
-
-
Save jonahwilliams/141a2a3a0dda577fcdbf86f115e09783 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java | |
index b8b781912..0febc8b60 100644 | |
--- a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java | |
+++ b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java | |
@@ -50,7 +50,7 @@ final class VideoPlayer { | |
private Surface surface; | |
- private final TextureRegistry.SurfaceTextureEntry textureEntry; | |
+ private final TextureRegistry.SurfaceProducer textureProducer; | |
private QueuingEventSink eventSink; | |
@@ -67,13 +67,13 @@ final class VideoPlayer { | |
VideoPlayer( | |
Context context, | |
EventChannel eventChannel, | |
- TextureRegistry.SurfaceTextureEntry textureEntry, | |
+ TextureRegistry.SurfaceProducer textureProducer, | |
String dataSource, | |
String formatHint, | |
@NonNull Map<String, String> httpHeaders, | |
VideoPlayerOptions options) { | |
this.eventChannel = eventChannel; | |
- this.textureEntry = textureEntry; | |
+ this.textureProducer = textureProducer; | |
this.options = options; | |
ExoPlayer exoPlayer = new ExoPlayer.Builder(context).build(); | |
@@ -96,12 +96,12 @@ final class VideoPlayer { | |
VideoPlayer( | |
ExoPlayer exoPlayer, | |
EventChannel eventChannel, | |
- TextureRegistry.SurfaceTextureEntry textureEntry, | |
+ TextureRegistry.SurfaceProducer textureProducer, | |
VideoPlayerOptions options, | |
QueuingEventSink eventSink, | |
DefaultHttpDataSource.Factory httpDataSourceFactory) { | |
this.eventChannel = eventChannel; | |
- this.textureEntry = textureEntry; | |
+ this.textureProducer = textureProducer; | |
this.options = options; | |
this.httpDataSourceFactory = httpDataSourceFactory; | |
@@ -186,7 +186,7 @@ final class VideoPlayer { | |
} | |
}); | |
- surface = new Surface(textureEntry.surfaceTexture()); | |
+ surface = textureProducer.getSurface(); | |
exoPlayer.setVideoSurface(surface); | |
setAudioAttributes(exoPlayer, options.mixWithOthers); | |
@@ -334,7 +334,7 @@ final class VideoPlayer { | |
if (isInitialized) { | |
exoPlayer.stop(); | |
} | |
- textureEntry.release(); | |
+ textureProducer.release(); | |
eventChannel.setStreamHandler(null); | |
if (surface != null) { | |
surface.release(); | |
diff --git a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java | |
index c0c602793..fb9e53489 100644 | |
--- a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java | |
+++ b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java | |
@@ -119,8 +119,8 @@ public class VideoPlayerPlugin implements FlutterPlugin, AndroidVideoPlayerApi { | |
} | |
public @NonNull TextureMessage create(@NonNull CreateMessage arg) { | |
- TextureRegistry.SurfaceTextureEntry handle = | |
- flutterState.textureRegistry.createSurfaceTexture(); | |
+ TextureRegistry.SurfaceProducer handle = | |
+ flutterState.textureRegistry.createSurfaceProducer(); | |
EventChannel eventChannel = | |
new EventChannel( | |
flutterState.binaryMessenger, "flutter.io/videoPlayer/videoEvents" + handle.id()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment