@NonNull public SimpleExoPlayer create(DrmSessionCreator drmSessionCreator, DefaultDrmSessionManager.EventListener drmSessionEventListener, MediaCodecSelector mediaCodecSelector) { DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = drmSessionCreator.create(drmSessionEventListener); RenderersFactory renderersFactory = new SimpleRenderersFactory( context, drmSessionManager, EXTENSION_RENDERER_MODE_OFF, DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS, mediaCodecSelector ); DefaultLoadControl loadControl = new DefaultLoadControl(); return ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, loadControl); }
private ExoPlayerTestRunner(PlayerFactory playerFactory, MediaSource mediaSource, RenderersFactory renderersFactory, MappingTrackSelector trackSelector, LoadControl loadControl, ActionSchedule actionSchedule, Player.EventListener eventListener) { this.playerFactory = playerFactory; this.mediaSource = mediaSource; this.renderersFactory = renderersFactory; this.trackSelector = trackSelector; this.loadControl = loadControl; this.actionSchedule = actionSchedule; this.eventListener = eventListener; this.timelines = new LinkedList<>(); this.manifests = new LinkedList<>(); this.periodIndices = new LinkedList<>(); this.endedCountDownLatch = new CountDownLatch(1); this.playerThread = new HandlerThread("ExoPlayerTest thread"); playerThread.start(); this.handler = new Handler(playerThread.getLooper()); }
public SimpleExoPlayer2(RenderersFactory renderersFactory, TrackSelector trackSelector, LoadControl loadControl) { componentListener = new ComponentListener(); videoListeners = new CopyOnWriteArraySet<>(); textOutputs = new CopyOnWriteArraySet<>(); metadataOutputs = new CopyOnWriteArraySet<>(); Looper eventLooper = Looper.myLooper() != null ? Looper.myLooper() : Looper.getMainLooper(); Handler eventHandler = new Handler(eventLooper); renderers = renderersFactory.createRenderers(eventHandler, componentListener, componentListener, componentListener, componentListener); // Obtain counts of video and audio renderers. int videoRendererCount = 0; int audioRendererCount = 0; for (Renderer renderer : renderers) { switch (renderer.getTrackType()) { case C.TRACK_TYPE_VIDEO: videoRendererCount++; break; case C.TRACK_TYPE_AUDIO: audioRendererCount++; break; } } this.videoRendererCount = videoRendererCount; this.audioRendererCount = audioRendererCount; // Set initial values. audioVolume = 1; audioSessionId = C.AUDIO_SESSION_ID_UNSET; audioAttributes = AudioAttributes.DEFAULT; videoScalingMode = C.VIDEO_SCALING_MODE_DEFAULT; // Build the player and associated objects. player = createExoPlayerImpl(renderers, trackSelector, loadControl); }
ExoPlayerPlaybackPreparer(ExtractorMediaSourceFactoryProvider extractorMediaSourceFactoryProvider, TrackSelector trackSelector, LoadControl loadControl, RenderersFactory renderersFactory, Handler handler, DiskFileCache diskFileCache, BestMatchUriProvider bestMatchUriProvider, RemoteFileUriProvider remoteFileUriProvider) { this.trackSelector = trackSelector; this.loadControl = loadControl; this.renderersFactory = renderersFactory; this.handler = handler; this.diskFileCache = diskFileCache; this.bestMatchUriProvider = bestMatchUriProvider; this.extractorMediaSourceFactoryProvider = extractorMediaSourceFactoryProvider; this.remoteFileUriProvider = remoteFileUriProvider; }
@SuppressWarnings("unused") protected SimpleExoPlayer buildExoPlayer(HostActivity host, Surface surface, MappingTrackSelector trackSelector, DrmSessionManager<FrameworkMediaCrypto> drmSessionManager) { RenderersFactory renderersFactory = new DefaultRenderersFactory(host, drmSessionManager, DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF, 0); SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector); player.setVideoSurface(surface); return player; }
InternalExoPlayer(RenderersFactory renderersFactory, TrackSelector trackSelector, LoadControl loadControl) { super(renderersFactory, trackSelector, loadControl); PLAYER_ID ++; mId = PLAYER_ID; PlayerLog.d("Lifecycle", "InternalExoPlayer init , Player Id is " + mId); }
static InternalExoPlayer newInstance(RenderersFactory renderersFactory, TrackSelector trackSelector) { return newInstance(renderersFactory, trackSelector, new DefaultLoadControl()); }
static InternalExoPlayer newInstance(RenderersFactory renderersFactory, TrackSelector trackSelector, LoadControl loadControl) { return new InternalExoPlayer(renderersFactory, trackSelector, loadControl); }
public FakeSimpleExoPlayer(RenderersFactory renderersFactory, TrackSelector trackSelector, LoadControl loadControl, FakeClock clock) { super (renderersFactory, trackSelector, loadControl); player.setFakeClock(clock); }
/** * Creates a new {@link SimpleExoPlayer} using the provided renderers factory, track selector, * and load control. * * @param renderersFactory A {@link RenderersFactory} to be used for the new player. * @param trackSelector A {@link MappingTrackSelector} to be used for the new player. * @param loadControl A {@link LoadControl} to be used for the new player. * @return A new {@link SimpleExoPlayer}. */ SimpleExoPlayer createExoPlayer(RenderersFactory renderersFactory, MappingTrackSelector trackSelector, LoadControl loadControl);
/** * Sets the {@link RenderersFactory} to be used by the test runner. The default factory creates * all renderers set by {@link #setRenderers(Renderer...)}. Setting the renderer factory is not * allowed after a call to {@link #setRenderers(Renderer...)}. * * @param renderersFactory A {@link RenderersFactory} to be used by the test runner. * @return This builder. */ public Builder setRenderersFactory(RenderersFactory renderersFactory) { Assert.assertNull(renderers); this.renderersFactory = renderersFactory; return this; }