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


Java HlsPlaylist类代码示例

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


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

示例1: buildRenderers

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
protected void buildRenderers(HlsPlaylist playlist) {
    if (canceled) {
        return;
    }

    boolean hasClosedCaptions = false;
    boolean hasMultipleAudioTracks = false;

    //Calculates the Chunk variant indices
    int[] variantIndices;
    if (playlist instanceof HlsMasterPlaylist) {
        HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) playlist;
        hasClosedCaptions = !masterPlaylist.subtitles.isEmpty();
        hasMultipleAudioTracks = !masterPlaylist.audios.isEmpty();
    }

    buildTrackRenderers(playlist, hasClosedCaptions, hasMultipleAudioTracks);
}
 
开发者ID:ayaseruri,项目名称:luxunPro,代码行数:19,代码来源:HlsRenderBuilder.java

示例2: onManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onManifest(String contentId, HlsPlaylist manifest) {
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  DataSource dataSource = new UriDataSource(userAgent, bandwidthMeter);
  HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter, null,
      HlsChunkSource.ADAPTIVE_MODE_SPLICE);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, true, 3);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
      MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(), player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

  MetadataTrackRenderer<Map<String, Object>> id3Renderer =
      new MetadataTrackRenderer<Map<String, Object>>(sampleSource, new Id3Parser(),
          player.getId3MetadataRenderer(), player.getMainHandler().getLooper());

  Eia608TrackRenderer closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TIMED_METADATA] = id3Renderer;
  renderers[DemoPlayer.TYPE_TEXT] = closedCaptionRenderer;
  callback.onRenderers(null, null, renderers);
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:27,代码来源:HlsRendererBuilder.java

示例3: onSingleManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onSingleManifest(HlsPlaylist manifest) {
  if (canceled) {
    return;
  }

  Handler mainHandler = player.getMainHandler();
  LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
  PtsTimestampAdjusterProvider timestampAdjusterProvider = new PtsTimestampAdjusterProvider();

  // Build the video/audio/metadata renderers.
  DataSource dataSource = createDataSource(context, userAgent, bandwidthMeter);
  HlsChunkSource chunkSource = new HlsChunkSource(true /* isMaster */, dataSource, url,
      manifest, DefaultHlsTrackSelector.newDefaultInstance(context), bandwidthMeter,
      timestampAdjusterProvider, HlsChunkSource.ADAPTIVE_MODE_SPLICE);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, loadControl,
      MAIN_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player, DemoPlayer.TYPE_VIDEO);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT,
      5000, mainHandler, player, 50);
  final MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(
      sampleSource, MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  final MetadataTrackRenderer<List<Id3Frame>> id3Renderer = new MetadataTrackRenderer<>(
      sampleSource, new Id3Parser(), player, mainHandler.getLooper());

  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_METADATA] = id3Renderer;
  player.onRenderers(renderers, bandwidthMeter);
}
 
开发者ID:mkjensen,项目名称:danish-media-license,代码行数:34,代码来源:HlsRendererBuilder.java

示例4: onSingleManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onSingleManifest(HlsPlaylist playlist) {
    if (canceled) {
        return;
    }

    buildRenderers(playlist);
}
 
开发者ID:ayaseruri,项目名称:luxunPro,代码行数:9,代码来源:HlsRenderBuilder.java

示例5: buildRenderers

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void buildRenderers(DemoPlayer player, RendererBuilderCallback callback) {
  this.player = player;
  this.callback = callback;
  HlsPlaylistParser parser = new HlsPlaylistParser();
  ManifestFetcher<HlsPlaylist> playlistFetcher = new ManifestFetcher<HlsPlaylist>(url,
      new DefaultUriDataSource(context, userAgent), parser);
  playlistFetcher.singleLoad(player.getMainHandler().getLooper(), this);
}
 
开发者ID:korrio,项目名称:AdvancedVideoView,代码行数:10,代码来源:HlsRendererBuilder.java

示例6: buildRenderers

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void buildRenderers(DemoPlayer player, DemoPlayer.RendererBuilderCallback callback) {
  this.player = player;
  this.callback = callback;
  HlsPlaylistParser parser = new HlsPlaylistParser();
  ManifestFetcher<HlsPlaylist> playlistFetcher = new ManifestFetcher<>(url,
      new DefaultUriDataSource(context, userAgent), parser);
  playlistFetcher.singleLoad(player.getMainHandler().getLooper(), this);
}
 
开发者ID:caspercba,项目名称:exoPlayerHLS,代码行数:10,代码来源:HlsRendererBuilder.java

示例7: onSingleManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onSingleManifest(HlsPlaylist manifest) {
  Handler mainHandler = player.getMainHandler();

  LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  int[] variantIndices = null;
  if (manifest instanceof HlsMasterPlaylist) {
    HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) manifest;
    try {
      variantIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
              context, masterPlaylist.variants, null, false);
    } catch (DecoderQueryException e) {
      callback.onRenderersError(e);
      return;
    }
  }

  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter,
      variantIndices, HlsChunkSource.ADAPTIVE_MODE_SPLICE, audioCapabilities);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, loadControl,
      BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, true, mainHandler, player, DemoPlayer.TYPE_VIDEO);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
      MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  callback.onRenderers(null, null, renderers, bandwidthMeter);
}
 
开发者ID:caspercba,项目名称:exoPlayerHLS,代码行数:34,代码来源:HlsRendererBuilder.java

示例8: buildRenderers

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void buildRenderers(DemoPlayer player, RendererBuilderCallback callback) {
  this.player = player;
  this.callback = callback;
  HlsPlaylistParser parser = new HlsPlaylistParser();
  ManifestFetcher<HlsPlaylist> playlistFetcher =
      new ManifestFetcher<HlsPlaylist>(parser, contentId, url, userAgent);
  playlistFetcher.singleLoad(player.getMainHandler().getLooper(), this);
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:10,代码来源:HlsRendererBuilder.java

示例9: onSingleManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onSingleManifest(HlsPlaylist manifest) {
  if (canceled) {
    return;
  }

  Handler mainHandler = player.getMainHandler();
  LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  int[] variantIndices = null;
  if (manifest instanceof HlsMasterPlaylist) {
    HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) manifest;
    try {
      variantIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
          context, masterPlaylist.variants, null, false);
    } catch (DecoderQueryException e) {
      player.onRenderersError(e);
      return;
    }
    if (variantIndices.length == 0) {
      player.onRenderersError(new IllegalStateException("No variants selected."));
      return;
    }
  }

  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter,
      variantIndices, HlsChunkSource.ADAPTIVE_MODE_SPLICE);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, loadControl,
      BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player, DemoPlayer.TYPE_VIDEO);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  MetadataTrackRenderer<Map<String, Object>> id3Renderer = new MetadataTrackRenderer<>(
      sampleSource, new Id3Parser(), player, mainHandler.getLooper());
  Eia608TrackRenderer closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_METADATA] = id3Renderer;
  renderers[DemoPlayer.TYPE_TEXT] = closedCaptionRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:48,代码来源:HlsRendererBuilder.java

示例10: onSingleManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onSingleManifest(HlsPlaylist manifest) {
  if (canceled) {
    return;
  }

  Handler mainHandler = player.getMainHandler();
  LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  int[] variantIndices = null;
  if (manifest instanceof HlsMasterPlaylist) {
    HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) manifest;
    try {
      variantIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
        context, masterPlaylist.variants, null, false);
    } catch (DecoderQueryException e) {
      player.onRenderersError(e);
      return;
    }
    if (variantIndices.length == 0) {
      player.onRenderersError(new IllegalStateException("No variants selected."));
      return;
    }
  }

  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter,
      variantIndices, HlsChunkSource.ADAPTIVE_MODE_SPLICE, audioCapabilities);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, loadControl,
      BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player, MediaPlayer.TYPE_VIDEO);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
      MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
  MetadataTrackRenderer<Map<String, Object>> id3Renderer = new MetadataTrackRenderer<>(
      sampleSource, new Id3Parser(), player, mainHandler.getLooper());
  Eia608TrackRenderer closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, player,
      mainHandler.getLooper());
  TrackRenderer[] renderers = new TrackRenderer[MediaPlayer.RENDERER_COUNT];
  renderers[MediaPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[MediaPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[MediaPlayer.TYPE_METADATA] = id3Renderer;
  renderers[MediaPlayer.TYPE_TEXT] = closedCaptionRenderer;
  player.onRenderers(null, null, renderers, bandwidthMeter);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:46,代码来源:HlsRendererBuilder.java

示例11: onSingleManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onSingleManifest(HlsPlaylist manifest) {
  if (canceled) {
    return;
  }

  Handler mainHandler = player.getMainHandler();
  LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  int[] variantIndices = null;
  if (manifest instanceof HlsMasterPlaylist) {
    HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) manifest;
    try {
      variantIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
          context, masterPlaylist.variants, null, false);
    } catch (DecoderQueryException e) {
      player.onRenderersError(e);
      return;
    }
    if (variantIndices.length == 0) {
      player.onRenderersError(new IllegalStateException("No variants selected."));
      return;
    }
  }

  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter,
      variantIndices, HlsChunkSource.ADAPTIVE_MODE_SPLICE);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, loadControl,
      BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player, Player.TYPE_VIDEO);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  MetadataTrackRenderer<Map<String, Object>> id3Renderer = new MetadataTrackRenderer<>(
      sampleSource, new Id3Parser(), player, mainHandler.getLooper());
  Eia608TrackRenderer closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  TrackRenderer[] renderers = new TrackRenderer[Player.RENDERER_COUNT];
  renderers[Player.TYPE_VIDEO] = videoRenderer;
  renderers[Player.TYPE_AUDIO] = audioRenderer;
  renderers[Player.TYPE_METADATA] = id3Renderer;
  renderers[Player.TYPE_TEXT] = closedCaptionRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
 
开发者ID:PJakcson,项目名称:Mediathek,代码行数:48,代码来源:HlsRendererBuilder.java

示例12: onSingleManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onSingleManifest(HlsPlaylist manifest) {
    if (canceled) {
        return;
    }

    Handler mainHandler = player.getMainHandler();
    LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

    int[] variantIndices = null;
    if (manifest instanceof HlsMasterPlaylist) {
        HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) manifest;
        try {
            variantIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
                    context, masterPlaylist.variants, null, false);
        } catch (DecoderQueryException e) {
            player.onRenderersError(e);
            return;
        }
        if (variantIndices.length == 0) {
            player.onRenderersError(new IllegalStateException("No variants selected."));
            return;
        }
    }

    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter,
            variantIndices, HlsChunkSource.ADAPTIVE_MODE_SPLICE, audioCapabilities);
    HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, loadControl,
            BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player, VideoPlayer.TYPE_VIDEO);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, mainHandler, player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
    MetadataTrackRenderer<Map<String, Object>> id3Renderer = new MetadataTrackRenderer<>(
            sampleSource, new Id3Parser(), player, mainHandler.getLooper());
    Eia608TrackRenderer closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, player,
            mainHandler.getLooper());

    TrackRenderer[] renderers = new TrackRenderer[VideoPlayer.RENDERER_COUNT];
    renderers[VideoPlayer.TYPE_VIDEO] = videoRenderer;
    renderers[VideoPlayer.TYPE_AUDIO] = audioRenderer;
    renderers[VideoPlayer.TYPE_METADATA] = id3Renderer;
    renderers[VideoPlayer.TYPE_TEXT] = closedCaptionRenderer;
    player.onRenderers(null, null, renderers, bandwidthMeter);
}
 
开发者ID:nextux,项目名称:sbs-android-tv,代码行数:47,代码来源:HlsRendererBuilder.java

示例13: buildTrackRenderers

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
protected void buildTrackRenderers(HlsPlaylist playlist, boolean hasClosedCaptions, boolean hasMultipleAudioTracks) {
    LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(), player);
    PtsTimestampAdjusterProvider timestampAdjusterProvider = new PtsTimestampAdjusterProvider();


    //Create the Sample Source to be used by the Video Renderer
    DataSource dataSourceVideo = createDataSource(okHttpClient, bandwidthMeter, userAgent);
    HlsChunkSource chunkSourceVideo = new HlsChunkSource(true, dataSourceVideo, playlist, DefaultHlsTrackSelector.newDefaultInstance(context),
            bandwidthMeter, timestampAdjusterProvider);
    HlsSampleSource sampleSourceVideo = new HlsSampleSource(chunkSourceVideo, loadControl,
            BUFFER_SEGMENTS_TOTAL * BUFFER_SEGMENT_SIZE, player.getMainHandler(), player, EMExoPlayer.RENDER_VIDEO);


    //Create the Sample Source to be used by the Audio Renderer
    DataSource dataSourceAudio = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    HlsChunkSource chunkSourceAudio = new HlsChunkSource(false, dataSourceAudio, playlist, DefaultHlsTrackSelector.newAudioInstance(),
            bandwidthMeter, timestampAdjusterProvider);
    HlsSampleSource sampleSourceAudio = new HlsSampleSource(chunkSourceAudio, loadControl, BUFFER_SEGMENTS_AUDIO * BUFFER_SEGMENT_SIZE,
            player.getMainHandler(), player, EMExoPlayer.RENDER_AUDIO);
    SampleSource[] sampleSourcesAudio = hasMultipleAudioTracks ? new SampleSource[] {sampleSourceVideo, sampleSourceAudio} : new SampleSource[] {sampleSourceVideo};


    //Create the Sample Source to be used by the Closed Captions Renderer
    DataSource dataSourceCC = createDataSource(okHttpClient, bandwidthMeter, userAgent);
    HlsChunkSource chunkSourceCC = new HlsChunkSource(false, dataSourceCC, playlist, DefaultHlsTrackSelector.newSubtitleInstance(),
            bandwidthMeter, timestampAdjusterProvider);
    HlsSampleSource sampleSourceCC = new HlsSampleSource(chunkSourceCC, loadControl,
            BUFFER_SEGMENTS_TEXT * BUFFER_SEGMENT_SIZE, player.getMainHandler(), player, EMExoPlayer.RENDER_CLOSED_CAPTION);


    //Build the renderers
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context, sampleSourceVideo, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, MAX_JOIN_TIME, player.getMainHandler(), player, DROPPED_FRAME_NOTIFICATION_AMOUNT);
    EMMediaCodecAudioTrackRenderer audioRenderer = new EMMediaCodecAudioTrackRenderer(sampleSourcesAudio, MediaCodecSelector.DEFAULT, null, true,
            player.getMainHandler(), player, AudioCapabilities.getCapabilities(context), streamType);
    TrackRenderer captionsRenderer = hasClosedCaptions ? new TextTrackRenderer(sampleSourceCC, player, player.getMainHandler().getLooper()) :
            new Eia608TrackRenderer(sampleSourceVideo, player, player.getMainHandler().getLooper());
    MetadataTrackRenderer<List<Id3Frame>> id3Renderer = new MetadataTrackRenderer<>(sampleSourceVideo, new Id3Parser(),
            player, player.getMainHandler().getLooper());


    //Populate the Render list to pass back to the callback
    TrackRenderer[] renderers = new TrackRenderer[EMExoPlayer.RENDER_COUNT];
    renderers[EMExoPlayer.RENDER_VIDEO] = videoRenderer;
    renderers[EMExoPlayer.RENDER_AUDIO] = audioRenderer;
    renderers[EMExoPlayer.RENDER_CLOSED_CAPTION] = captionsRenderer;
    renderers[EMExoPlayer.RENDER_TIMED_METADATA] = id3Renderer;
    player.onRenderers(renderers, bandwidthMeter);
}
 
开发者ID:ayaseruri,项目名称:luxunPro,代码行数:51,代码来源:HlsRenderBuilder.java

示例14: onSingleManifest

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
@Override
public void onSingleManifest(HlsPlaylist manifest) {
  Handler mainHandler = player.getMainHandler();
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  int[] variantIndices = null;
  if (manifest instanceof HlsMasterPlaylist) {
    HlsMasterPlaylist masterPlaylist = (HlsMasterPlaylist) manifest;
    try {
      variantIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(
              context, masterPlaylist.variants, null, false);
    } catch (DecoderQueryException e) {
      callback.onRenderersError(e);
      return;
    }
  }

  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter,
      variantIndices, HlsChunkSource.ADAPTIVE_MODE_SPLICE, audioCapabilities);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, true, 3, REQUESTED_BUFFER_SIZE,
      REQUESTED_BUFFER_DURATION_MS, mainHandler, player, DemoPlayer.TYPE_VIDEO);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
      MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

  MetadataTrackRenderer<Map<String, Object>> id3Renderer =
      new MetadataTrackRenderer<Map<String, Object>>(sampleSource, new Id3Parser(),
          player.getId3MetadataRenderer(), mainHandler.getLooper());

  Eia608TrackRenderer closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Build the debug renderer.
  TrackRenderer debugRenderer = debugTextView != null
      ? new DebugTrackRenderer(debugTextView, player, videoRenderer) : null;

  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TIMED_METADATA] = id3Renderer;
  renderers[DemoPlayer.TYPE_TEXT] = closedCaptionRenderer;
  renderers[DemoPlayer.TYPE_DEBUG] = debugRenderer;
  callback.onRenderers(null, null, renderers);
}
 
开发者ID:korrio,项目名称:AdvancedVideoView,代码行数:46,代码来源:HlsRendererBuilder.java

示例15: create

import com.google.android.exoplayer.hls.HlsPlaylist; //导入依赖的package包/类
HlsChunkSource create(DataSource dataSource, HlsPlaylist playlist,
BandwidthMeter bandwidthMeter, PtsTimestampAdjusterProvider timestampAdjusterProvider,
int[] variantIndices);
 
开发者ID:satorufujiwara,项目名称:exoplayer-textureview,代码行数:4,代码来源:HlsChunkSourceCreator.java


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