当前位置: 首页>>代码示例>>Java>>正文


Java FileDataSource类代码示例

本文整理汇总了Java中com.google.android.exoplayer.upstream.FileDataSource的典型用法代码示例。如果您正苦于以下问题:Java FileDataSource类的具体用法?Java FileDataSource怎么用?Java FileDataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileDataSource类属于com.google.android.exoplayer.upstream包,在下文中一共展示了FileDataSource类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildRenderers

import com.google.android.exoplayer.upstream.FileDataSource; //导入依赖的package包/类
@Override
public void buildRenderers(ExoPlayerHelper player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    Extractor webmExtractor = new WebmExtractor();
    Extractor mp4Extractor = new Mp4Extractor();
    DataSource dataSource = new FileDataSource();
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, webmExtractor, mp4Extractor);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
            player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource, MediaCodecSelector.DEFAULT,
            null, true, player.getMainHandler(), player);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[ExoPlayerHelper.RENDERER_COUNT];
    renderers[ExoPlayerHelper.TYPE_VIDEO] = videoRenderer;
    renderers[ExoPlayerHelper.TYPE_AUDIO] = audioRenderer;
    renderers[ExoPlayerHelper.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, null);
}
 
开发者ID:MimiReader,项目名称:mimi-reader,代码行数:26,代码来源:WebmRendererBuilder.java

示例2: loadDrmInitData

import com.google.android.exoplayer.upstream.FileDataSource; //导入依赖的package包/类
private void loadDrmInitData(Representation representation) throws IOException {
    Uri initFile = representation.getInitializationUri().getUri();
    
    FileDataSource initChunkSource = new FileDataSource();
    DataSpec initDataSpec = new DataSpec(initFile);
    int trigger = 2;
    ChunkExtractorWrapper extractorWrapper = new ChunkExtractorWrapper(new FragmentedMp4Extractor());
    InitializationChunk chunk = new InitializationChunk(initChunkSource, initDataSpec, trigger, format, extractorWrapper);
    try {
        chunk.load();
    } catch (InterruptedException e) {
        Log.d(TAG, "Interrupted!", e);
    }
    if (!chunk.isLoadCanceled()) {
        drmInitData = chunk.getDrmInitData();
    }
    
    if (drmInitData != null) {
        DrmInitData.SchemeInitData schemeInitData = OfflineDrmManager.getWidevineInitData(drmInitData);
        if (schemeInitData != null) {
            widevineInitData = schemeInitData.data;
        }
    }
}
 
开发者ID:kaltura,项目名称:player-sdk-native-android,代码行数:25,代码来源:SimpleDashParser.java

示例3: CacheDataSource

import com.google.android.exoplayer.upstream.FileDataSource; //导入依赖的package包/类
/**
 * Constructs an instance with default {@link DataSource} and {@link DataSink} instances for
 * reading and writing the cache. The sink is configured to fragment data such that no single
 * cache file is greater than maxCacheFileSize bytes.
 */
public CacheDataSource(Cache cache, DataSource upstream, boolean blockOnCache,
    boolean ignoreCacheOnError, long maxCacheFileSize) {
  this(cache, upstream, new FileDataSource(), new CacheDataSink(cache, maxCacheFileSize),
      blockOnCache, ignoreCacheOnError, null);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:11,代码来源:CacheDataSource.java


注:本文中的com.google.android.exoplayer.upstream.FileDataSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。