mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Add getPlaybackLooper() to ExoPlayer v2.
A few components in ExoPlayer requires playback looper to operate (such as: DrmSessionManager#acquireSession), so this CL add back getPlaybackLooper() to facilitate such cases. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=159416012
This commit is contained in:
parent
d9ea8f7143
commit
56ff2ef598
4 changed files with 22 additions and 0 deletions
|
|
@ -283,6 +283,13 @@ public interface ExoPlayer {
|
|||
*/
|
||||
int REPEAT_MODE_ALL = 2;
|
||||
|
||||
/**
|
||||
* Gets the {@link Looper} associated with the playback thread.
|
||||
*
|
||||
* @return The {@link Looper} associated with the playback thread.
|
||||
*/
|
||||
Looper getPlaybackLooper();
|
||||
|
||||
/**
|
||||
* Register a listener to receive events from the player. The listener's methods will be called on
|
||||
* the thread that was used to construct the player. However, if the thread used to construct the
|
||||
|
|
|
|||
|
|
@ -106,6 +106,11 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||
repeatMode, eventHandler, playbackInfo, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Looper getPlaybackLooper() {
|
||||
return internalPlayer.getPlaybackLooper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(EventListener listener) {
|
||||
listeners.add(listener);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2;
|
|||
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
import android.os.SystemClock;
|
||||
|
|
@ -270,6 +271,10 @@ import java.io.IOException;
|
|||
internalPlaybackThread.quit();
|
||||
}
|
||||
|
||||
public Looper getPlaybackLooper() {
|
||||
return internalPlaybackThread.getLooper();
|
||||
}
|
||||
|
||||
// MediaSource.Listener implementation.
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -480,6 +480,11 @@ public class SimpleExoPlayer implements ExoPlayer {
|
|||
|
||||
// ExoPlayer implementation
|
||||
|
||||
@Override
|
||||
public Looper getPlaybackLooper() {
|
||||
return player.getPlaybackLooper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(EventListener listener) {
|
||||
player.addListener(listener);
|
||||
|
|
|
|||
Loading…
Reference in a new issue