-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Migrate video_player/android
from SurfaceTexture
->SurfaceProducer
.
#6456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
77ccaea
54b24cb
6866d44
d3eacba
782ee27
3ae8f75
89296f6
c0c6b9b
8b46bd6
9b378ae
54a0738
713cbc7
6664ecd
76ec4bd
076d53b
a9e9f2a
90eb1d5
f9cf7d4
5e3289c
ee2a30d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ final class VideoPlayer { | |
|
||
private Surface surface; | ||
|
||
private final TextureRegistry.SurfaceTextureEntry textureEntry; | ||
private final TextureRegistry.SurfaceProducer surfaceProducer; | ||
|
||
private QueuingEventSink eventSink; | ||
|
||
|
@@ -67,13 +67,13 @@ final class VideoPlayer { | |
VideoPlayer( | ||
Context context, | ||
EventChannel eventChannel, | ||
TextureRegistry.SurfaceTextureEntry textureEntry, | ||
TextureRegistry.SurfaceProducer surfaceProducer, | ||
String dataSource, | ||
String formatHint, | ||
@NonNull Map<String, String> httpHeaders, | ||
VideoPlayerOptions options) { | ||
this.eventChannel = eventChannel; | ||
this.textureEntry = textureEntry; | ||
this.surfaceProducer = surfaceProducer; | ||
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 surfaceProducer, | ||
VideoPlayerOptions options, | ||
QueuingEventSink eventSink, | ||
DefaultHttpDataSource.Factory httpDataSourceFactory) { | ||
this.eventChannel = eventChannel; | ||
this.textureEntry = textureEntry; | ||
this.surfaceProducer = surfaceProducer; | ||
this.options = options; | ||
this.httpDataSourceFactory = httpDataSourceFactory; | ||
|
||
|
@@ -186,7 +186,7 @@ public void onCancel(Object o) { | |
} | ||
}); | ||
|
||
surface = new Surface(textureEntry.surfaceTexture()); | ||
surface = surfaceProducer.getSurface(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note, the returned Surface may become invalid after a suspend / resume. Is there a place in the plugin that will be notified when we resume? We should update the video surface in that callback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to look at this still. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've made this activity aware. It now tears down the exoplayer on pause and recreates on reusme. |
||
exoPlayer.setVideoSurface(surface); | ||
setAudioAttributes(exoPlayer, options.mixWithOthers); | ||
|
||
|
@@ -334,7 +334,7 @@ void dispose() { | |
if (isInitialized) { | ||
exoPlayer.stop(); | ||
} | ||
textureEntry.release(); | ||
surfaceProducer.release(); | ||
eventChannel.setStreamHandler(null); | ||
if (surface != null) { | ||
surface.release(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need to cache surface.