public AsyncRendererBuilder(Context context, String userAgent, String url, DemoPlayer player) { this.context = context; this.userAgent = userAgent; this.url = url; this.player = player; HlsPlaylistParser parser = new HlsPlaylistParser(); playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent), parser); }
DashChunkSource(ManifestFetcher<MediaPresentationDescription> manifestFetcher, MediaPresentationDescription initialManifest, DashTrackSelector trackSelector, DataSource dataSource, FormatEvaluator adaptiveFormatEvaluator, Clock systemClock, long liveEdgeLatencyUs, long elapsedRealtimeOffsetUs, boolean startAtLiveEdge, Handler eventHandler, EventListener eventListener, int eventSourceId) { this.manifestFetcher = manifestFetcher; this.currentManifest = initialManifest; this.trackSelector = trackSelector; this.dataSource = dataSource; this.adaptiveFormatEvaluator = adaptiveFormatEvaluator; this.systemClock = systemClock; this.liveEdgeLatencyUs = liveEdgeLatencyUs; this.elapsedRealtimeOffsetUs = elapsedRealtimeOffsetUs; this.startAtLiveEdge = startAtLiveEdge; this.eventHandler = eventHandler; this.eventListener = eventListener; this.eventSourceId = eventSourceId; this.evaluation = new Evaluation(); this.availableRangeValues = new long[2]; periodHolders = new SparseArray<>(); tracks = new ArrayList<>(); live = initialManifest.dynamic; }
public AsyncRendererBuilder(Context context, String userAgent, String url, MediaDrmCallback drmCallback, DemoPlayer player) { this.context = context; this.userAgent = userAgent; this.drmCallback = drmCallback; this.player = player; MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser(); manifestDataSource = new DefaultUriDataSource(context, userAgent); manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, MediaDrmCallback drmCallback, DemoPlayer player) { this.context = context; this.userAgent = userAgent; this.drmCallback = drmCallback; this.player = player; SmoothStreamingManifestParser parser = new SmoothStreamingManifestParser(); manifestFetcher = new ManifestFetcher<>(url, new DefaultHttpDataSource(userAgent, null), parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, MediaDrmCallback drmCallback, VideoPlayer player) { this.context = context; this.userAgent = userAgent; this.drmCallback = drmCallback; this.player = player; MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser(); manifestDataSource = new DefaultUriDataSource(context, userAgent); manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, VideoPlayer player) { this.context = context; this.userAgent = userAgent; this.url = url; this.player = player; HlsPlaylistParser parser = new HlsPlaylistParser(); playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent), parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, DemoPlayer player) { this.context = context; this.userAgent = userAgent; this.player = player; HlsPlaylistParser parser = new HlsPlaylistParser(); playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent), parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, ExVidPlayerImp player) { this.context = context; this.userAgent = userAgent; this.url = url; this.player = player; HlsPlaylistParser parser = new HlsPlaylistParser(); playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent), parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, MediaDrmCallback drmCallback, AudioCapabilities audioCapabilities, MediaPlayer player) { this.context = context; this.userAgent = userAgent; this.drmCallback = drmCallback; this.audioCapabilities = audioCapabilities; this.player = player; MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser(); manifestDataSource = new DefaultUriDataSource(context, userAgent); manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, AudioCapabilities audioCapabilities, MediaPlayer player) { this.context = context; this.userAgent = userAgent; this.url = url; this.audioCapabilities = audioCapabilities; this.player = player; HlsPlaylistParser parser = new HlsPlaylistParser(); playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent), parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, MediaDrmCallback drmCallback, MediaPlayer player) { this.context = context; this.userAgent = userAgent; this.drmCallback = drmCallback; this.player = player; SmoothStreamingManifestParser parser = new SmoothStreamingManifestParser(); manifestFetcher = new ManifestFetcher<>(url, new DefaultHttpDataSource(userAgent, null), parser); }
/** * Loads a manifest. * * @param context A context. * @param tag A tag to use for logging. * @param url The manifest url. * @param parser A suitable parser for the manifest. * @return The parser manifest. * @throws IOException If an error occurs loading the manifest. */ public static <T> T loadManifest(Context context, String tag, String url, UriLoadable.Parser<T> parser) throws IOException { String userAgent = getUserAgent(context); int retryCount = 0; while (true) { try { DefaultUriDataSource manifestDataSource = new DefaultUriDataSource(context, userAgent); ManifestFetcher<T> manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser); SyncManifestCallback<T> callback = new SyncManifestCallback<>(); manifestFetcher.singleLoad(context.getMainLooper(), callback); return callback.getResult(); } catch (IOException e) { if (retryCount++ < MANIFEST_LOAD_MAX_RETRY_COUNT) { // Sleep, then try again. Log.e(tag, "Failed to load manifest", e); try { Thread.sleep(5000); } catch (InterruptedException e2) { // Never happens. throw new InterruptedIOException(); } } else { // Give up. throw e; } } } }
private SmoothStreamingChunkSource(ManifestFetcher<SmoothStreamingManifest> manifestFetcher, SmoothStreamingManifest initialManifest, SmoothStreamingTrackSelector trackSelector, DataSource dataSource, FormatEvaluator adaptiveFormatEvaluator, long liveEdgeLatencyMs) { this.manifestFetcher = manifestFetcher; this.currentManifest = initialManifest; this.trackSelector = trackSelector; this.dataSource = dataSource; this.adaptiveFormatEvaluator = adaptiveFormatEvaluator; this.liveEdgeLatencyUs = liveEdgeLatencyMs * 1000; evaluation = new Evaluation(); tracks = new ArrayList<>(); extractorWrappers = new SparseArray<>(); mediaFormats = new SparseArray<>(); live = initialManifest.isLive; ProtectionElement protectionElement = initialManifest.protectionElement; if (protectionElement != null) { byte[] keyId = getProtectionElementKeyId(protectionElement.data); trackEncryptionBoxes = new TrackEncryptionBox[1]; trackEncryptionBoxes[0] = new TrackEncryptionBox(true, INITIALIZATION_VECTOR_SIZE, keyId); drmInitData = new DrmInitData.Mapped(); drmInitData.put(protectionElement.uuid, new SchemeInitData(MimeTypes.VIDEO_MP4, protectionElement.data)); } else { trackEncryptionBoxes = null; drmInitData = null; } }
private static DashChunkSource buildDashChunkSource(MediaPresentationDescription mpd, boolean startAtLiveEdge, long liveEdgeLatencyMs) { @SuppressWarnings("unchecked") ManifestFetcher<MediaPresentationDescription> manifestFetcher = mock(ManifestFetcher.class); when(manifestFetcher.getManifest()).thenReturn(mpd); DashChunkSource chunkSource = new DashChunkSource(manifestFetcher, mpd, DefaultDashTrackSelector.newVideoInstance(null, false, false), mock(DataSource.class), null, new FakeClock(mpd.availabilityStartTime + mpd.duration - ELAPSED_REALTIME_OFFSET_MS), liveEdgeLatencyMs * 1000, ELAPSED_REALTIME_OFFSET_MS * 1000, startAtLiveEdge, null, null, 0); chunkSource.prepare(); chunkSource.enable(0); return chunkSource; }
public AsyncRendererBuilder(Context context, String userAgent, String url, MediaDrmCallback drmCallback, Player player) { this.context = context; this.userAgent = userAgent; this.drmCallback = drmCallback; this.player = player; MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser(); manifestDataSource = new DefaultUriDataSource(context, userAgent); manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, Player player) { this.context = context; this.userAgent = userAgent; this.url = url; this.player = player; HlsPlaylistParser parser = new HlsPlaylistParser(); playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent), parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, MediaDrmCallback drmCallback, Player player) { this.context = context; this.userAgent = userAgent; this.drmCallback = drmCallback; this.player = player; SmoothStreamingManifestParser parser = new SmoothStreamingManifestParser(); manifestFetcher = new ManifestFetcher<>(url, new DefaultHttpDataSource(userAgent, null), parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, AudioCapabilities audioCapabilities, VideoPlayer player) { this.context = context; this.userAgent = userAgent; this.url = url; this.audioCapabilities = audioCapabilities; this.player = player; HlsPlaylistParser parser = new HlsPlaylistParser(); playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent), parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, DemoPlayer player) { this.context = context; this.userAgent = userAgent; this.player = player; MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser(); manifestDataSource = new DefaultUriDataSource(context, userAgent); manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser); }
public AsyncRendererBuilder(Context context, String userAgent, String url, DemoPlayer player) { this.context = context; this.userAgent = userAgent; this.url = url; this.player = player; HlsPlaylistParser parser = new HlsPlaylistParser(); playlistFetcher = new ManifestFetcher<>(url, createDataSource(context, userAgent), parser); }