com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker Java Examples
The following examples show how to use
com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HlsMediaSource.java From MediaSDK with Apache License 2.0 | 6 votes |
private HlsMediaSource( Uri manifestUri, HlsDataSourceFactory dataSourceFactory, HlsExtractorFactory extractorFactory, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, DrmSessionManager<?> drmSessionManager, LoadErrorHandlingPolicy loadErrorHandlingPolicy, HlsPlaylistTracker playlistTracker, boolean allowChunklessPreparation, @MetadataType int metadataType, boolean useSessionKeys, @Nullable Object tag) { this.manifestUri = manifestUri; this.dataSourceFactory = dataSourceFactory; this.extractorFactory = extractorFactory; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.drmSessionManager = drmSessionManager; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.playlistTracker = playlistTracker; this.allowChunklessPreparation = allowChunklessPreparation; this.metadataType = metadataType; this.useSessionKeys = useSessionKeys; this.tag = tag; }
Example #2
Source File: HlsMediaSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
private HlsMediaSource( Uri manifestUri, HlsDataSourceFactory dataSourceFactory, HlsExtractorFactory extractorFactory, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, LoadErrorHandlingPolicy loadErrorHandlingPolicy, HlsPlaylistTracker playlistTracker, boolean allowChunklessPreparation, @HlsMetadataType int metadataType, boolean useSessionKeys, @Nullable Object tag) { this.manifestUri = manifestUri; this.dataSourceFactory = dataSourceFactory; this.extractorFactory = extractorFactory; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.playlistTracker = playlistTracker; this.allowChunklessPreparation = allowChunklessPreparation; this.metadataType = metadataType; this.useSessionKeys = useSessionKeys; this.tag = tag; }
Example #3
Source File: HlsMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private HlsMediaSource( Uri manifestUri, HlsDataSourceFactory dataSourceFactory, HlsExtractorFactory extractorFactory, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, LoadErrorHandlingPolicy<Chunk> chunkLoadErrorHandlingPolicy, int minLoadableRetryCount, HlsPlaylistTracker playlistTracker, boolean allowChunklessPreparation, @Nullable Object tag) { this.manifestUri = manifestUri; this.dataSourceFactory = dataSourceFactory; this.extractorFactory = extractorFactory; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.chunkLoadErrorHandlingPolicy = chunkLoadErrorHandlingPolicy; this.minLoadableRetryCount = minLoadableRetryCount; this.playlistTracker = playlistTracker; this.allowChunklessPreparation = allowChunklessPreparation; this.tag = tag; }
Example #4
Source File: HlsMediaSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private HlsMediaSource( Uri manifestUri, HlsDataSourceFactory dataSourceFactory, HlsExtractorFactory extractorFactory, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, LoadErrorHandlingPolicy loadErrorHandlingPolicy, HlsPlaylistTracker playlistTracker, boolean allowChunklessPreparation, @HlsMetadataType int metadataType, boolean useSessionKeys, @Nullable Object tag) { this.manifestUri = manifestUri; this.dataSourceFactory = dataSourceFactory; this.extractorFactory = extractorFactory; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.playlistTracker = playlistTracker; this.allowChunklessPreparation = allowChunklessPreparation; this.metadataType = metadataType; this.useSessionKeys = useSessionKeys; this.tag = tag; }
Example #5
Source File: HlsChunkSource.java From K-Sonic with MIT License | 6 votes |
/** * @param playlistTracker The {@link HlsPlaylistTracker} from which to obtain media playlists. * @param variants The available variants. * @param dataSourceFactory An {@link HlsDataSourceFactory} to create {@link DataSource}s for the * chunks. * @param timestampAdjusterProvider A provider of {@link TimestampAdjuster} instances. If * multiple {@link HlsChunkSource}s are used for a single playback, they should all share the * same provider. * @param muxedCaptionFormats List of muxed caption {@link Format}s. */ public HlsChunkSource(HlsPlaylistTracker playlistTracker, HlsUrl[] variants, HlsDataSourceFactory dataSourceFactory, TimestampAdjusterProvider timestampAdjusterProvider, List<Format> muxedCaptionFormats) { this.playlistTracker = playlistTracker; this.variants = variants; this.timestampAdjusterProvider = timestampAdjusterProvider; this.muxedCaptionFormats = muxedCaptionFormats; Format[] variantFormats = new Format[variants.length]; int[] initialTrackSelection = new int[variants.length]; for (int i = 0; i < variants.length; i++) { variantFormats[i] = variants[i].format; initialTrackSelection[i] = i; } mediaDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_MEDIA); encryptionDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_DRM); trackGroup = new TrackGroup(variantFormats); trackSelection = new InitializationTrackSelection(trackGroup, initialTrackSelection); }
Example #6
Source File: HlsMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private HlsMediaSource( Uri manifestUri, HlsDataSourceFactory dataSourceFactory, HlsExtractorFactory extractorFactory, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, LoadErrorHandlingPolicy<Chunk> chunkLoadErrorHandlingPolicy, int minLoadableRetryCount, HlsPlaylistTracker playlistTracker, boolean allowChunklessPreparation, @Nullable Object tag) { this.manifestUri = manifestUri; this.dataSourceFactory = dataSourceFactory; this.extractorFactory = extractorFactory; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.chunkLoadErrorHandlingPolicy = chunkLoadErrorHandlingPolicy; this.minLoadableRetryCount = minLoadableRetryCount; this.playlistTracker = playlistTracker; this.allowChunklessPreparation = allowChunklessPreparation; this.tag = tag; }
Example #7
Source File: HlsChunkSource.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * @param extractorFactory An {@link HlsExtractorFactory} from which to obtain the extractors for * media chunks. * @param playlistTracker The {@link HlsPlaylistTracker} from which to obtain media playlists. * @param playlistUrls The {@link Uri}s of the media playlists that can be adapted between by this * chunk source. * @param playlistFormats The {@link Format Formats} corresponding to the media playlists. * @param dataSourceFactory An {@link HlsDataSourceFactory} to create {@link DataSource}s for the * chunks. * @param mediaTransferListener The transfer listener which should be informed of any media data * transfers. May be null if no listener is available. * @param timestampAdjusterProvider A provider of {@link TimestampAdjuster} instances. If multiple * {@link HlsChunkSource}s are used for a single playback, they should all share the same * provider. * @param muxedCaptionFormats List of muxed caption {@link Format}s. Null if no closed caption * information is available in the master playlist. */ public HlsChunkSource( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, Uri[] playlistUrls, Format[] playlistFormats, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, TimestampAdjusterProvider timestampAdjusterProvider, List<Format> muxedCaptionFormats) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.playlistUrls = playlistUrls; this.playlistFormats = playlistFormats; this.timestampAdjusterProvider = timestampAdjusterProvider; this.muxedCaptionFormats = muxedCaptionFormats; keyCache = new FullSegmentEncryptionKeyCache(); liveEdgeInPeriodTimeUs = C.TIME_UNSET; mediaDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_MEDIA); if (mediaTransferListener != null) { mediaDataSource.addTransferListener(mediaTransferListener); } encryptionDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_DRM); trackGroup = new TrackGroup(playlistFormats); int[] initialTrackSelection = new int[playlistUrls.length]; for (int i = 0; i < playlistUrls.length; i++) { initialTrackSelection[i] = i; } trackSelection = new InitializationTrackSelection(trackGroup, initialTrackSelection); }
Example #8
Source File: HlsMediaPeriod.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * Creates an HLS media period. * * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments. * @param playlistTracker A tracker for HLS playlists. * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments * and keys. * @param mediaTransferListener The transfer listener to inform of any media data transfers. May * be null if no listener is available. * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}. * @param eventDispatcher A dispatcher to notify of events. * @param allocator An {@link Allocator} from which to obtain media buffer allocations. * @param compositeSequenceableLoaderFactory A factory to create composite {@link * SequenceableLoader}s for when this media source loads data from multiple streams. * @param allowChunklessPreparation Whether chunkless preparation is allowed. * @param useSessionKeys Whether to use #EXT-X-SESSION-KEY tags. */ public HlsMediaPeriod( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Allocator allocator, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, boolean allowChunklessPreparation, @HlsMetadataType int metadataType, boolean useSessionKeys) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.dataSourceFactory = dataSourceFactory; this.mediaTransferListener = mediaTransferListener; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.allocator = allocator; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.allowChunklessPreparation = allowChunklessPreparation; this.metadataType = metadataType; this.useSessionKeys = useSessionKeys; compositeSequenceableLoader = compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(); streamWrapperIndices = new IdentityHashMap<>(); timestampAdjusterProvider = new TimestampAdjusterProvider(); sampleStreamWrappers = new HlsSampleStreamWrapper[0]; enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0]; manifestUrlIndicesPerWrapper = new int[0][]; eventDispatcher.mediaPeriodCreated(); }
Example #9
Source File: HlsChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * @param extractorFactory An {@link HlsExtractorFactory} from which to obtain the extractors for * media chunks. * @param playlistTracker The {@link HlsPlaylistTracker} from which to obtain media playlists. * @param playlistUrls The {@link Uri}s of the media playlists that can be adapted between by this * chunk source. * @param playlistFormats The {@link Format Formats} corresponding to the media playlists. * @param dataSourceFactory An {@link HlsDataSourceFactory} to create {@link DataSource}s for the * chunks. * @param mediaTransferListener The transfer listener which should be informed of any media data * transfers. May be null if no listener is available. * @param timestampAdjusterProvider A provider of {@link TimestampAdjuster} instances. If multiple * {@link HlsChunkSource}s are used for a single playback, they should all share the same * provider. * @param muxedCaptionFormats List of muxed caption {@link Format}s. Null if no closed caption * information is available in the master playlist. */ public HlsChunkSource( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, Uri[] playlistUrls, Format[] playlistFormats, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, TimestampAdjusterProvider timestampAdjusterProvider, List<Format> muxedCaptionFormats) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.playlistUrls = playlistUrls; this.playlistFormats = playlistFormats; this.timestampAdjusterProvider = timestampAdjusterProvider; this.muxedCaptionFormats = muxedCaptionFormats; keyCache = new FullSegmentEncryptionKeyCache(); liveEdgeInPeriodTimeUs = C.TIME_UNSET; mediaDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_MEDIA); if (mediaTransferListener != null) { mediaDataSource.addTransferListener(mediaTransferListener); } encryptionDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_DRM); trackGroup = new TrackGroup(playlistFormats); int[] initialTrackSelection = new int[playlistUrls.length]; for (int i = 0; i < playlistUrls.length; i++) { initialTrackSelection[i] = i; } trackSelection = new InitializationTrackSelection(trackGroup, initialTrackSelection); }
Example #10
Source File: HlsMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * Creates an HLS media period. * * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments. * @param playlistTracker A tracker for HLS playlists. * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments * and keys. * @param mediaTransferListener The transfer listener to inform of any media data transfers. May * be null if no listener is available. * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}. * @param eventDispatcher A dispatcher to notify of events. * @param allocator An {@link Allocator} from which to obtain media buffer allocations. * @param compositeSequenceableLoaderFactory A factory to create composite {@link * SequenceableLoader}s for when this media source loads data from multiple streams. * @param allowChunklessPreparation Whether chunkless preparation is allowed. * @param useSessionKeys Whether to use #EXT-X-SESSION-KEY tags. */ public HlsMediaPeriod( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Allocator allocator, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, boolean allowChunklessPreparation, @HlsMetadataType int metadataType, boolean useSessionKeys) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.dataSourceFactory = dataSourceFactory; this.mediaTransferListener = mediaTransferListener; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.allocator = allocator; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.allowChunklessPreparation = allowChunklessPreparation; this.metadataType = metadataType; this.useSessionKeys = useSessionKeys; compositeSequenceableLoader = compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(); streamWrapperIndices = new IdentityHashMap<>(); timestampAdjusterProvider = new TimestampAdjusterProvider(); sampleStreamWrappers = new HlsSampleStreamWrapper[0]; enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0]; manifestUrlIndicesPerWrapper = new int[0][]; eventDispatcher.mediaPeriodCreated(); }
Example #11
Source File: HlsMediaPeriod.java From K-Sonic with MIT License | 5 votes |
public HlsMediaPeriod(HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory, int minLoadableRetryCount, EventDispatcher eventDispatcher, Allocator allocator, long positionUs) { this.playlistTracker = playlistTracker; this.dataSourceFactory = dataSourceFactory; this.minLoadableRetryCount = minLoadableRetryCount; this.eventDispatcher = eventDispatcher; this.allocator = allocator; streamWrapperIndices = new IdentityHashMap<>(); timestampAdjusterProvider = new TimestampAdjusterProvider(); continueLoadingHandler = new Handler(); preparePositionUs = positionUs; }
Example #12
Source File: HlsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @param extractorFactory An {@link HlsExtractorFactory} from which to obtain the extractors for * media chunks. * @param playlistTracker The {@link HlsPlaylistTracker} from which to obtain media playlists. * @param variants The available variants. * @param dataSourceFactory An {@link HlsDataSourceFactory} to create {@link DataSource}s for the * chunks. * @param mediaTransferListener The transfer listener which should be informed of any media data * transfers. May be null if no listener is available. * @param timestampAdjusterProvider A provider of {@link TimestampAdjuster} instances. If multiple * {@link HlsChunkSource}s are used for a single playback, they should all share the same * provider. * @param muxedCaptionFormats List of muxed caption {@link Format}s. Null if no closed caption * information is available in the master playlist. */ public HlsChunkSource( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, HlsUrl[] variants, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, TimestampAdjusterProvider timestampAdjusterProvider, List<Format> muxedCaptionFormats) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.variants = variants; this.timestampAdjusterProvider = timestampAdjusterProvider; this.muxedCaptionFormats = muxedCaptionFormats; liveEdgeInPeriodTimeUs = C.TIME_UNSET; Format[] variantFormats = new Format[variants.length]; int[] initialTrackSelection = new int[variants.length]; for (int i = 0; i < variants.length; i++) { variantFormats[i] = variants[i].format; initialTrackSelection[i] = i; } mediaDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_MEDIA); if (mediaTransferListener != null) { mediaDataSource.addTransferListener(mediaTransferListener); } encryptionDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_DRM); trackGroup = new TrackGroup(variantFormats); trackSelection = new InitializationTrackSelection(trackGroup, initialTrackSelection); }
Example #13
Source File: HlsMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Creates an HLS media period. * * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments. * @param playlistTracker A tracker for HLS playlists. * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments * and keys. * @param mediaTransferListener The transfer listener to inform of any media data transfers. May * be null if no listener is available. * @param chunkLoadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy} for chunk loads. * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs. * @param eventDispatcher A dispatcher to notify of events. * @param allocator An {@link Allocator} from which to obtain media buffer allocations. * @param compositeSequenceableLoaderFactory A factory to create composite {@link * SequenceableLoader}s for when this media source loads data from multiple streams. * @param allowChunklessPreparation Whether chunkless preparation is allowed. */ public HlsMediaPeriod( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, LoadErrorHandlingPolicy<Chunk> chunkLoadErrorHandlingPolicy, int minLoadableRetryCount, EventDispatcher eventDispatcher, Allocator allocator, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, boolean allowChunklessPreparation) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.dataSourceFactory = dataSourceFactory; this.mediaTransferListener = mediaTransferListener; this.chunkLoadErrorHandlingPolicy = chunkLoadErrorHandlingPolicy; this.minLoadableRetryCount = minLoadableRetryCount; this.eventDispatcher = eventDispatcher; this.allocator = allocator; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.allowChunklessPreparation = allowChunklessPreparation; compositeSequenceableLoader = compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(); streamWrapperIndices = new IdentityHashMap<>(); timestampAdjusterProvider = new TimestampAdjusterProvider(); sampleStreamWrappers = new HlsSampleStreamWrapper[0]; enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0]; eventDispatcher.mediaPeriodCreated(); }
Example #14
Source File: HlsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @param extractorFactory An {@link HlsExtractorFactory} from which to obtain the extractors for * media chunks. * @param playlistTracker The {@link HlsPlaylistTracker} from which to obtain media playlists. * @param variants The available variants. * @param dataSourceFactory An {@link HlsDataSourceFactory} to create {@link DataSource}s for the * chunks. * @param mediaTransferListener The transfer listener which should be informed of any media data * transfers. May be null if no listener is available. * @param timestampAdjusterProvider A provider of {@link TimestampAdjuster} instances. If multiple * {@link HlsChunkSource}s are used for a single playback, they should all share the same * provider. * @param muxedCaptionFormats List of muxed caption {@link Format}s. Null if no closed caption * information is available in the master playlist. */ public HlsChunkSource( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, HlsUrl[] variants, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, TimestampAdjusterProvider timestampAdjusterProvider, List<Format> muxedCaptionFormats) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.variants = variants; this.timestampAdjusterProvider = timestampAdjusterProvider; this.muxedCaptionFormats = muxedCaptionFormats; liveEdgeInPeriodTimeUs = C.TIME_UNSET; Format[] variantFormats = new Format[variants.length]; int[] initialTrackSelection = new int[variants.length]; for (int i = 0; i < variants.length; i++) { variantFormats[i] = variants[i].format; initialTrackSelection[i] = i; } mediaDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_MEDIA); if (mediaTransferListener != null) { mediaDataSource.addTransferListener(mediaTransferListener); } encryptionDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_DRM); trackGroup = new TrackGroup(variantFormats); trackSelection = new InitializationTrackSelection(trackGroup, initialTrackSelection); }
Example #15
Source File: HlsMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Creates an HLS media period. * * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments. * @param playlistTracker A tracker for HLS playlists. * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments * and keys. * @param mediaTransferListener The transfer listener to inform of any media data transfers. May * be null if no listener is available. * @param chunkLoadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy} for chunk loads. * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs. * @param eventDispatcher A dispatcher to notify of events. * @param allocator An {@link Allocator} from which to obtain media buffer allocations. * @param compositeSequenceableLoaderFactory A factory to create composite {@link * SequenceableLoader}s for when this media source loads data from multiple streams. * @param allowChunklessPreparation Whether chunkless preparation is allowed. */ public HlsMediaPeriod( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, LoadErrorHandlingPolicy<Chunk> chunkLoadErrorHandlingPolicy, int minLoadableRetryCount, EventDispatcher eventDispatcher, Allocator allocator, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, boolean allowChunklessPreparation) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.dataSourceFactory = dataSourceFactory; this.mediaTransferListener = mediaTransferListener; this.chunkLoadErrorHandlingPolicy = chunkLoadErrorHandlingPolicy; this.minLoadableRetryCount = minLoadableRetryCount; this.eventDispatcher = eventDispatcher; this.allocator = allocator; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.allowChunklessPreparation = allowChunklessPreparation; compositeSequenceableLoader = compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(); streamWrapperIndices = new IdentityHashMap<>(); timestampAdjusterProvider = new TimestampAdjusterProvider(); sampleStreamWrappers = new HlsSampleStreamWrapper[0]; enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0]; eventDispatcher.mediaPeriodCreated(); }
Example #16
Source File: HlsChunkSource.java From MediaSDK with Apache License 2.0 | 5 votes |
/** * @param extractorFactory An {@link HlsExtractorFactory} from which to obtain the extractors for * media chunks. * @param playlistTracker The {@link HlsPlaylistTracker} from which to obtain media playlists. * @param playlistUrls The {@link Uri}s of the media playlists that can be adapted between by this * chunk source. * @param playlistFormats The {@link Format Formats} corresponding to the media playlists. * @param dataSourceFactory An {@link HlsDataSourceFactory} to create {@link DataSource}s for the * chunks. * @param mediaTransferListener The transfer listener which should be informed of any media data * transfers. May be null if no listener is available. * @param timestampAdjusterProvider A provider of {@link TimestampAdjuster} instances. If multiple * {@link HlsChunkSource}s are used for a single playback, they should all share the same * provider. * @param muxedCaptionFormats List of muxed caption {@link Format}s. Null if no closed caption * information is available in the master playlist. */ public HlsChunkSource( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, Uri[] playlistUrls, Format[] playlistFormats, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, TimestampAdjusterProvider timestampAdjusterProvider, @Nullable List<Format> muxedCaptionFormats) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.playlistUrls = playlistUrls; this.playlistFormats = playlistFormats; this.timestampAdjusterProvider = timestampAdjusterProvider; this.muxedCaptionFormats = muxedCaptionFormats; keyCache = new FullSegmentEncryptionKeyCache(KEY_CACHE_SIZE); scratchSpace = Util.EMPTY_BYTE_ARRAY; liveEdgeInPeriodTimeUs = C.TIME_UNSET; mediaDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_MEDIA); if (mediaTransferListener != null) { mediaDataSource.addTransferListener(mediaTransferListener); } encryptionDataSource = dataSourceFactory.createDataSource(C.DATA_TYPE_DRM); trackGroup = new TrackGroup(playlistFormats); int[] initialTrackSelection = new int[playlistUrls.length]; for (int i = 0; i < playlistUrls.length; i++) { initialTrackSelection[i] = i; } trackSelection = new InitializationTrackSelection(trackGroup, initialTrackSelection); }
Example #17
Source File: HlsMediaPeriod.java From MediaSDK with Apache License 2.0 | 5 votes |
/** * Creates an HLS media period. * * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments. * @param playlistTracker A tracker for HLS playlists. * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments * and keys. * @param mediaTransferListener The transfer listener to inform of any media data transfers. May * be null if no listener is available. * @param drmSessionManager The {@link DrmSessionManager} to acquire {@link DrmSession * DrmSessions} with. * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}. * @param eventDispatcher A dispatcher to notify of events. * @param allocator An {@link Allocator} from which to obtain media buffer allocations. * @param compositeSequenceableLoaderFactory A factory to create composite {@link * SequenceableLoader}s for when this media source loads data from multiple streams. * @param allowChunklessPreparation Whether chunkless preparation is allowed. * @param useSessionKeys Whether to use #EXT-X-SESSION-KEY tags. */ public HlsMediaPeriod( HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory, @Nullable TransferListener mediaTransferListener, DrmSessionManager<?> drmSessionManager, LoadErrorHandlingPolicy loadErrorHandlingPolicy, EventDispatcher eventDispatcher, Allocator allocator, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, boolean allowChunklessPreparation, @HlsMediaSource.MetadataType int metadataType, boolean useSessionKeys) { this.extractorFactory = extractorFactory; this.playlistTracker = playlistTracker; this.dataSourceFactory = dataSourceFactory; this.mediaTransferListener = mediaTransferListener; this.drmSessionManager = drmSessionManager; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.eventDispatcher = eventDispatcher; this.allocator = allocator; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.allowChunklessPreparation = allowChunklessPreparation; this.metadataType = metadataType; this.useSessionKeys = useSessionKeys; compositeSequenceableLoader = compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(); streamWrapperIndices = new IdentityHashMap<>(); timestampAdjusterProvider = new TimestampAdjusterProvider(); sampleStreamWrappers = new HlsSampleStreamWrapper[0]; enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0]; manifestUrlIndicesPerWrapper = new int[0][]; eventDispatcher.mediaPeriodCreated(); }
Example #18
Source File: HlsMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 3 votes |
/** * Sets the HLS playlist tracker. The default is an instance of {@link * DefaultHlsPlaylistTracker}. Playlist trackers must not be shared by {@link HlsMediaSource} * instances. * * <p>Must not be called after calling {@link #setPlaylistParser} on the same builder. * * @param playlistTracker A tracker for HLS playlists. * @return This factory, for convenience. * @throws IllegalStateException If one of the {@code create} methods has already been called. */ public Factory setPlaylistTracker(HlsPlaylistTracker playlistTracker) { Assertions.checkState(!isCreateCalled); Assertions.checkState(playlistParser == null, "A playlist parser has already been set."); this.playlistTracker = Assertions.checkNotNull(playlistTracker); return this; }
Example #19
Source File: HlsMediaSource.java From TelePlus-Android with GNU General Public License v2.0 | 3 votes |
/** * Sets the HLS playlist tracker. The default is an instance of {@link * DefaultHlsPlaylistTracker}. Playlist trackers must not be shared by {@link HlsMediaSource} * instances. * * <p>Must not be called after calling {@link #setPlaylistParser} on the same builder. * * @param playlistTracker A tracker for HLS playlists. * @return This factory, for convenience. * @throws IllegalStateException If one of the {@code create} methods has already been called. */ public Factory setPlaylistTracker(HlsPlaylistTracker playlistTracker) { Assertions.checkState(!isCreateCalled); Assertions.checkState(playlistParser == null, "A playlist parser has already been set."); this.playlistTracker = Assertions.checkNotNull(playlistTracker); return this; }
Example #20
Source File: HlsMediaSource.java From Telegram-FOSS with GNU General Public License v2.0 | 2 votes |
/** * Sets the {@link HlsPlaylistTracker} factory. The default value is {@link * DefaultHlsPlaylistTracker#FACTORY}. * * @param playlistTrackerFactory A factory for {@link HlsPlaylistTracker} instances. * @return This factory, for convenience. * @throws IllegalStateException If one of the {@code create} methods has already been called. */ public Factory setPlaylistTrackerFactory(HlsPlaylistTracker.Factory playlistTrackerFactory) { Assertions.checkState(!isCreateCalled); this.playlistTrackerFactory = Assertions.checkNotNull(playlistTrackerFactory); return this; }
Example #21
Source File: HlsMediaSource.java From Telegram with GNU General Public License v2.0 | 2 votes |
/** * Sets the {@link HlsPlaylistTracker} factory. The default value is {@link * DefaultHlsPlaylistTracker#FACTORY}. * * @param playlistTrackerFactory A factory for {@link HlsPlaylistTracker} instances. * @return This factory, for convenience. * @throws IllegalStateException If one of the {@code create} methods has already been called. */ public Factory setPlaylistTrackerFactory(HlsPlaylistTracker.Factory playlistTrackerFactory) { Assertions.checkState(!isCreateCalled); this.playlistTrackerFactory = Assertions.checkNotNull(playlistTrackerFactory); return this; }
Example #22
Source File: HlsMediaSource.java From MediaSDK with Apache License 2.0 | 2 votes |
/** * Sets the {@link HlsPlaylistTracker} factory. The default value is {@link * DefaultHlsPlaylistTracker#FACTORY}. * * @param playlistTrackerFactory A factory for {@link HlsPlaylistTracker} instances. * @return This factory, for convenience. * @throws IllegalStateException If one of the {@code create} methods has already been called. */ public Factory setPlaylistTrackerFactory(HlsPlaylistTracker.Factory playlistTrackerFactory) { Assertions.checkState(!isCreateCalled); this.playlistTrackerFactory = Assertions.checkNotNull(playlistTrackerFactory); return this; }