mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Remove player listener on the application thread of the player
PiperOrigin-RevId: 497183220
(cherry picked from commit fc22f89fde)
This commit is contained in:
parent
70156dce4f
commit
d67df79d1e
2 changed files with 10 additions and 3 deletions
|
|
@ -49,6 +49,8 @@
|
|||
* Cast extension
|
||||
* Bump Cast SDK version to 21.2.0.
|
||||
* IMA extension
|
||||
* Remove player listener of the `ImaServerSideAdInsertionMediaSource` on
|
||||
the application thread to avoid threading issues.
|
||||
* Bump IMA SDK version to 3.29.0.
|
||||
|
||||
### 1.0.0-beta03 (2022-11-22)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import android.content.Context;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Pair;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.IntDef;
|
||||
|
|
@ -495,7 +496,8 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
|
|||
this.applicationAdEventListener = applicationAdEventListener;
|
||||
this.applicationAdErrorListener = applicationAdErrorListener;
|
||||
componentListener = new ComponentListener();
|
||||
mainHandler = Util.createHandlerForCurrentLooper();
|
||||
Assertions.checkArgument(player.getApplicationLooper() == Looper.getMainLooper());
|
||||
mainHandler = new Handler(Looper.getMainLooper());
|
||||
Uri streamRequestUri = checkNotNull(mediaItem.localConfiguration).uri;
|
||||
isLiveStream = ImaServerSideAdInsertionUriBuilder.isLiveStream(streamRequestUri);
|
||||
adsId = ImaServerSideAdInsertionUriBuilder.getAdsId(streamRequestUri);
|
||||
|
|
@ -572,8 +574,11 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
|
|||
super.releaseSourceInternal();
|
||||
if (loader != null) {
|
||||
loader.release();
|
||||
player.removeListener(componentListener);
|
||||
mainHandler.post(() -> setStreamManager(/* streamManager= */ null));
|
||||
mainHandler.post(
|
||||
() -> {
|
||||
player.removeListener(componentListener);
|
||||
setStreamManager(/* streamManager= */ null);
|
||||
});
|
||||
loader = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue