diff --git a/app/src/main/java/ie/macinnes/tvheadend/player/Player.java b/app/src/main/java/ie/macinnes/tvheadend/player/Player.java index 1de7123..0a7f2ec 100644 --- a/app/src/main/java/ie/macinnes/tvheadend/player/Player.java +++ b/app/src/main/java/ie/macinnes/tvheadend/player/Player.java @@ -102,7 +102,9 @@ public interface Listener { private final SharedPreferences mSharedPreferences; private SimpleExoPlayer mExoPlayer; + private RenderersFactory mRenderersFactory; private TvheadendTrackSelector mTrackSelector; + private LoadControl mLoadControl; private EventLogger mEventLogger; private DataSource.Factory mDataSourceFactory; private ExtractorsFactory mExtractorsFactory; @@ -200,14 +202,11 @@ private void buildExoPlayer() { TrackSelection.Factory trackSelectionFactory = new AdaptiveTrackSelection.Factory(null); + mRenderersFactory = new TvheadendRenderersFactory(mContext); mTrackSelector = new TvheadendTrackSelector(trackSelectionFactory); + mLoadControl = buildLoadControl(); - LoadControl loadControl = buildLoadControl(); - - RenderersFactory renderersFactory = new TvheadendRenderersFactory( - mContext, null, TvheadendRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS); - - mExoPlayer = ExoPlayerFactory.newSimpleInstance(renderersFactory, mTrackSelector, loadControl); + mExoPlayer = ExoPlayerFactory.newSimpleInstance(mRenderersFactory, mTrackSelector, mLoadControl); mExoPlayer.addListener(this); // Add the EventLogger diff --git a/app/src/main/java/ie/macinnes/tvheadend/player/TvheadendRenderersFactory.java b/app/src/main/java/ie/macinnes/tvheadend/player/TvheadendRenderersFactory.java index 4c0f1c0..72cd10e 100644 --- a/app/src/main/java/ie/macinnes/tvheadend/player/TvheadendRenderersFactory.java +++ b/app/src/main/java/ie/macinnes/tvheadend/player/TvheadendRenderersFactory.java @@ -20,13 +20,10 @@ import android.content.SharedPreferences; import android.os.Build; import android.os.Handler; -import android.os.Looper; import android.util.Log; import com.google.android.exoplayer2.DefaultRenderersFactory; import com.google.android.exoplayer2.Renderer; -import com.google.android.exoplayer2.RenderersFactory; -import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.audio.AudioCapabilities; import com.google.android.exoplayer2.audio.AudioProcessor; import com.google.android.exoplayer2.audio.AudioRendererEventListener; @@ -37,8 +34,6 @@ import com.google.android.exoplayer2.mediacodec.MediaCodecInfo; import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; import com.google.android.exoplayer2.mediacodec.MediaCodecUtil; -import com.google.android.exoplayer2.metadata.MetadataRenderer; -import com.google.android.exoplayer2.text.TextRenderer; import com.google.android.exoplayer2.video.MediaCodecVideoRenderer; import com.google.android.exoplayer2.video.VideoRendererEventListener; @@ -50,18 +45,8 @@ public class TvheadendRenderersFactory extends DefaultRenderersFactory { private static final String TAG = TvheadendRenderersFactory.class.getName(); - private final Context mContext; - private final DrmSessionManager mDrmSessionManager; - private final long mAllowedVideoJoiningTimeMs; - - public TvheadendRenderersFactory(Context context, - DrmSessionManager drmSessionManager, - long allowedVideoJoiningTimeMs) { - super(context, drmSessionManager, EXTENSION_RENDERER_MODE_ON, allowedVideoJoiningTimeMs); - - mContext = context; - mDrmSessionManager = drmSessionManager; - mAllowedVideoJoiningTimeMs = allowedVideoJoiningTimeMs; + public TvheadendRenderersFactory(Context context) { + super(context, null, EXTENSION_RENDERER_MODE_ON, DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS); } /**