Java 类com.google.android.exoplayer.TrackRenderer 实例源码

项目:AndroidTvDemo    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
  Handler mainHandler = player.getMainHandler();

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, mainHandler, player, 0);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT, null, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:androidtv-sample    文件:DemoPlayer.java   
/**
   * Invoked with the results from a {@link RendererBuilder}.
   *
   * @param renderers      Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual
   *                       element may be null if there do not exist tracks of the corresponding
   *                       type.
   * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be
   *                       null.
   */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
      for (int i = 0; i < RENDERER_COUNT; i++) {
          if (renderers[i] == null) {
              // Convert a null renderer to a dummy renderer.
              renderers[i] = new DummyTrackRenderer();
          }
      }
      // Complete preparation.
      this.videoRenderer = renderers[TYPE_VIDEO];
      this.audioRenderer = renderers[TYPE_AUDIO];
      this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
              : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
      this.bandwidthMeter = bandwidthMeter;
      pushSurface(false);
      player.prepare(renderers);
      rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
  }
项目:androidtv-sample    文件:VideoPlayer.java   
/**
   * Invoked with the results from a {@link RendererBuilder}.
   *
   * @param renderers      Renderers indexed by {@link VideoPlayer} TYPE_* constants. An
   *                       individual element may be null if there do not exist tracks of the
   *                       corresponding type.
   * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be
   *                       null.
   */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
      for (int i = 0; i < RENDERER_COUNT; i++) {
          if (renderers[i] == null) {
              // Convert a null renderer to a dummy renderer.
              renderers[i] = new DummyTrackRenderer();
          }
      }
      // Complete preparation.
      this.videoRenderer = renderers[TYPE_VIDEO];
      this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
              : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
      this.bandwidthMeter = bandwidthMeter;
      pushSurface(false);
      player.prepare(renderers);
      rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
  }
项目:AndroidTvDemo    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:chilly    文件:VideoPlayer.java   
/**
   * Invoked with the results from a {@link RendererBuilder}.
   *
   * @param renderers      Renderers indexed by {@link VideoPlayer} TYPE_* constants. An
   *                       individual element may be null if there do not exist tracks of the
   *                       corresponding type.
   * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be
   *                       null.
   */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
      for (int i = 0; i < RENDERER_COUNT; i++) {
          if (renderers[i] == null) {
              // Convert a null renderer to a dummy renderer.
              renderers[i] = new DummyTrackRenderer();
          }
      }
      // Complete preparation.
      this.videoRenderer = renderers[TYPE_VIDEO];
      this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
              : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
      this.bandwidthMeter = bandwidthMeter;
      pushSurface(false);
      player.prepare(renderers);
      rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
  }
项目:ShaddockVideoPlayer    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:ShaddockVideoPlayer    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
  Handler mainHandler = player.getMainHandler();

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, mainHandler, player, 0);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT, null, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:android-tv-news    文件:VideoPlayer.java   
/**
   * Invoked with the results from a {@link RendererBuilder}.
   *
   * @param renderers      Renderers indexed by {@link VideoPlayer} TYPE_* constants. An
   *                       individual element may be null if there do not exist tracks of the
   *                       corresponding type.
   * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be
   *                       null.
   */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
      for (int i = 0; i < RENDERER_COUNT; i++) {
          if (renderers[i] == null) {
              // Convert a null renderer to a dummy renderer.
              renderers[i] = new DummyTrackRenderer();
          }
      }
      // Complete preparation.
      this.videoRenderer = renderers[TYPE_VIDEO];
      this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
              : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
      this.bandwidthMeter = bandwidthMeter;
      pushSurface(false);
      player.prepare(renderers);
      rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
  }
项目:mimi-reader    文件:WebmRendererBuilder.java   
@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);
}
项目:mimi-reader    文件:ExoPlayerHelper.java   
/**
   * Invoked with the results from a {@link RendererBuilder}.
   *
   * @param renderers      Renderers indexed by {@link ExoPlayerHelper} TYPE_* constants. An individual
   *                       element may be null if there do not exist tracks of the corresponding type.
   * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
   */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
      for (int i = 0; i < RENDERER_COUNT; i++) {
          if (renderers[i] == null) {
              // Convert a null renderer to a dummy renderer.
              renderers[i] = new DummyTrackRenderer();
          }
      }
      // Complete preparation.
      this.videoRenderer = renderers[TYPE_VIDEO];
      this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
              : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
      this.bandwidthMeter = bandwidthMeter;
      pushSurface(false);
      player.prepare(renderers);
      rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
  }
项目:ExoPlayerController    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {@link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:ExoPlayerController    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:FriendsCameraSDK-android    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {@link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:talk-android    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:talk-android    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:android_packages_apps_tv    文件:MpegTsPlayer.java   
private void onRenderers(TrackRenderer[] renderers) {
    mBuilderCallback = null;
    for (int i = 0; i < RENDERER_COUNT; i++) {
        if (renderers[i] == null) {
            // Convert a null renderer to a dummy renderer.
            renderers[i] = new DummyTrackRenderer();
        }
    }
    mVideoRenderer = renderers[TRACK_TYPE_VIDEO];
    mAudioRenderer = renderers[TRACK_TYPE_AUDIO];
    mTextRenderer = (Cea708TextTrackRenderer) renderers[TRACK_TYPE_TEXT];
    mTextRenderer.setCcListener(mCcListener);
    mPlayer.sendMessage(
            mTextRenderer, Cea708TextTrackRenderer.MSG_SERVICE_NUMBER, mCaptionServiceNumber);
    mRendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
    pushSurface(false);
    mPlayer.prepare(renderers);
    pushTrackSelection(TRACK_TYPE_VIDEO, true);
    pushTrackSelection(TRACK_TYPE_AUDIO, true);
    pushTrackSelection(TRACK_TYPE_TEXT, true);
}
项目:android_packages_apps_tv    文件:Ac3PassthroughTrackRenderer.java   
private void ensureAudioTrackInitialized() {
    if (!AUDIO_TRACK.isInitialized()) {
        try {
            if (DEBUG) {
                Log.d(TAG, "AudioTrack initialized");
            }
            AUDIO_TRACK.initialize();
        } catch (AudioTrack.InitializationException e) {
            Log.e(TAG, "Error on AudioTrack initialization", e);
            notifyAudioTrackInitializationError(e);

            // Do not throw exception here but just disabling audioTrack to keep playing
            // video without audio.
            AUDIO_TRACK.setStatus(false);
        }
        if (getState() == TrackRenderer.STATE_STARTED) {
            if (DEBUG) {
                Log.d(TAG, "AudioTrack played");
            }
            AUDIO_TRACK.play();
        }
    }
}
项目:android_packages_apps_tv    文件:MpegTsRendererBuilder.java   
@Override
public void buildRenderers(MpegTsPlayer mpegTsPlayer, DataSource dataSource,
        RendererBuilderCallback callback) {
    // Build the video and audio renderers.
    SampleExtractor extractor = dataSource == null ?
            new MpegTsSampleExtractor(mBufferManager, mBufferListener) :
            new MpegTsSampleExtractor(dataSource, mBufferManager, mBufferListener);
    SampleSource sampleSource = new MpegTsSampleSource(extractor);
    MpegTsVideoTrackRenderer videoRenderer = new MpegTsVideoTrackRenderer(mContext,
            sampleSource, mpegTsPlayer.getMainHandler(), mpegTsPlayer);
    // TODO: Only using Ac3PassthroughTrackRenderer for A/V sync issue. We will use
    // {@link Ac3TrackRenderer} when we use ExoPlayer's extractor.
    TrackRenderer audioRenderer = new Ac3PassthroughTrackRenderer(sampleSource,
            mpegTsPlayer.getMainHandler(), mpegTsPlayer);
    Cea708TextTrackRenderer textRenderer = new Cea708TextTrackRenderer(sampleSource);

    TrackRenderer[] renderers = new TrackRenderer[MpegTsPlayer.RENDERER_COUNT];
    renderers[MpegTsPlayer.TRACK_TYPE_VIDEO] = videoRenderer;
    renderers[MpegTsPlayer.TRACK_TYPE_AUDIO] = audioRenderer;
    renderers[MpegTsPlayer.TRACK_TYPE_TEXT] = textRenderer;
    callback.onRenderers(null, renderers);
}
项目:OKPlayer    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:OKPlayer    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
  Handler mainHandler = player.getMainHandler();

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, mainHandler, player, 0);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT, null, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:miku    文件:ExtractorSampleSource.java   
@Override
public long getBufferedPositionUs() {
  if (loadingFinished) {
    return TrackRenderer.END_OF_TRACK_US;
  } else if (isPendingReset()) {
    return pendingResetPositionUs;
  } else {
    long largestParsedTimestampUs = Long.MIN_VALUE;
    for (int i = 0; i < sampleQueues.size(); i++) {
      largestParsedTimestampUs = Math.max(largestParsedTimestampUs,
          sampleQueues.valueAt(i).getLargestParsedTimestampUs());
    }
    return largestParsedTimestampUs == Long.MIN_VALUE ? downstreamPositionUs
        : largestParsedTimestampUs;
  }
}
项目:miku    文件:TextTrackRenderer.java   
@Override
protected int doPrepare(long positionUs) {
  boolean sourcePrepared = source.prepare(positionUs);
  if (!sourcePrepared) {
    return TrackRenderer.STATE_UNPREPARED;
  }
  int trackCount = source.getTrackCount();
  for (int i = 0; i < subtitleParsers.length; i++) {
    for (int j = 0; j < trackCount; j++) {
      if (subtitleParsers[i].canParse(source.getTrackInfo(j).mimeType)) {
        parserIndex = i;
        trackIndex = j;
        return TrackRenderer.STATE_PREPARED;
      }
    }
  }
  return TrackRenderer.STATE_IGNORE;
}
项目:miku    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(MediaPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
      null, true, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, null, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[MediaPlayer.RENDERER_COUNT];
  renderers[MediaPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[MediaPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[MediaPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(null, null, renderers, bandwidthMeter);
}
项目:ExoPlayer-Demo    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {@link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:ExoPlayer-Demo    文件:HlsSampleSource.java   
@Override
public long getBufferedPositionUs() {
  Assertions.checkState(prepared);
  Assertions.checkState(enabledTrackCount > 0);
  if (isPendingReset()) {
    return pendingResetPositionUs;
  } else if (loadingFinished) {
    return TrackRenderer.END_OF_TRACK_US;
  } else {
    long largestParsedTimestampUs = extractors.getLast().getLargestParsedTimestampUs();
    if (extractors.size() > 1) {
      // When adapting from one format to the next, the penultimate extractor may have the largest
      // parsed timestamp (e.g. if the last extractor hasn't parsed any timestamps yet).
      largestParsedTimestampUs = Math.max(largestParsedTimestampUs,
          extractors.get(extractors.size() - 2).getLargestParsedTimestampUs());
    }
    return largestParsedTimestampUs == Long.MIN_VALUE ? downstreamPositionUs
        : largestParsedTimestampUs;
  }
}
项目:ExoPlayer-Demo    文件:ExtractorSampleSource.java   
@Override
public long getBufferedPositionUs() {
  if (loadingFinished) {
    return TrackRenderer.END_OF_TRACK_US;
  } else if (isPendingReset()) {
    return pendingResetPositionUs;
  } else {
    long largestParsedTimestampUs = Long.MIN_VALUE;
    for (int i = 0; i < sampleQueues.size(); i++) {
      largestParsedTimestampUs = Math.max(largestParsedTimestampUs,
          sampleQueues.valueAt(i).getLargestParsedTimestampUs());
    }
    return largestParsedTimestampUs == Long.MIN_VALUE ? downstreamPositionUs
        : largestParsedTimestampUs;
  }
}
项目:Mediathek    文件:Player.java   
/**
   * Invoked with the results from a {@link RendererBuilder}.
   *
   * @param renderers Renderers indexed by {@link Player} TYPE_* constants. An individual
   *     element may be null if there do not exist tracks of the corresponding type.
   * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
   */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
      for (int i = 0; i < RENDERER_COUNT; i++) {
          if (renderers[i] == null) {
              // Convert a null renderer to a dummy renderer.
              renderers[i] = new DummyTrackRenderer();
          }
      }
      // Complete preparation.
      this.videoRenderer = renderers[TYPE_VIDEO];
      this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
              : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
              ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
      this.bandwidthMeter = bandwidthMeter;
      pushSurface(false);
      player.prepare(renderers);
      rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
  }
项目:Mediathek    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(Player player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[Player.RENDERER_COUNT];
  renderers[Player.TYPE_VIDEO] = videoRenderer;
  renderers[Player.TYPE_AUDIO] = audioRenderer;
  renderers[Player.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:droidkaigi2016    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {@link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:ChannelSurfer    文件:ExoPlayerInputProvider.java   
/**
 * Will load and begin to play any RTMP, HLS, or MPEG2-DASH stream
 * Should also be able to play local videos and audio files
 * @param uri The URL where the file resides
 */
public void play(String uri) {
    tvInputPlayer.setSurface(mSurface);
    try {
        Log.d(TAG, "Play "+uri+"; "+uri.indexOf("asset:///"));
        if(uri.contains("asset:///")) {
            Log.i(TAG, "Is a local file");
            DataSource dataSource=new AssetDataSource(getApplicationContext());
            ExtractorSampleSource extractorSampleSource=new ExtractorSampleSource(Uri.parse(uri),dataSource,new DefaultAllocator(1000),5000);
            TrackRenderer audio=new MediaCodecAudioTrackRenderer(extractorSampleSource,null,null,true);
            tvInputPlayer.prepare(audio, null, null);
        } else {
            tvInputPlayer.prepare(getApplicationContext(), Uri.parse(uri), TvInputPlayer.SOURCE_TYPE_HLS);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    tvInputPlayer.setPlayWhenReady(true);

}
项目:danish-media-license    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {@link RendererBuilder}.
 *
 * @param renderers      Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual
 *                       element may be null if there do not exist tracks of the corresponding
 *                       type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:WliveTV    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:WliveTV    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:Android-Example-HLS-ExoPlayer    文件:DemoPlayer.java   
/**
 * Invoked with the results from a {@link RendererBuilder}.
 *
 * @param renderers Renderers indexed by {@link DemoPlayer} TYPE_* constants. An individual
 *     element may be null if there do not exist tracks of the corresponding type.
 * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null.
 */
/* package */ void onRenderers(TrackRenderer[] renderers, BandwidthMeter bandwidthMeter) {
  for (int i = 0; i < RENDERER_COUNT; i++) {
    if (renderers[i] == null) {
      // Convert a null renderer to a dummy renderer.
      renderers[i] = new DummyTrackRenderer();
    }
  }
  // Complete preparation.
  this.videoRenderer = renderers[TYPE_VIDEO];
  this.codecCounters = videoRenderer instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) videoRenderer).codecCounters
      : renderers[TYPE_AUDIO] instanceof MediaCodecTrackRenderer
      ? ((MediaCodecTrackRenderer) renderers[TYPE_AUDIO]).codecCounters : null;
  this.bandwidthMeter = bandwidthMeter;
  pushSurface(false);
  player.prepare(renderers);
  rendererBuildingState = RENDERER_BUILDING_STATE_BUILT;
}
项目:luxunPro    文件:EMExoPlayer.java   
public void onRenderers(TrackRenderer[] renderers, @Nullable BandwidthMeter bandwidthMeter) {
    for (int i = 0; i < RENDER_COUNT; i++) {
        if (renderers[i] == null) {
            // Convert a null renderer to a dummy renderer.
            renderers[i] = new DummyTrackRenderer();
        }
    }

    // Complete preparation.
    this.videoRenderer = renderers[RENDER_VIDEO];
    this.audioRenderer = renderers[RENDER_AUDIO];

    pushSurface(false);
    player.prepare(renderers);
    rendererBuildingState = RenderBuildingState.BUILT;
}
项目:luxunPro    文件:RenderBuilder.java   
public void buildRenderers(EMExoPlayer player) {
    //Create the Sample Source to be used by the renderers
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(), player);
    DataSource dataSource = createDataSource(okHttpClient, null, userAgent);

    ExtractorSampleSource sampleSource = new ExtractorSampleSource(Uri.parse(MediaUtil.getUriWithProtocol(uri)), dataSource,
           allocator, BUFFER_SEGMENT_SIZE * BUFFER_SEGMENTS_TOTAL, player.getMainHandler(), player, 0);

    //Create the Renderers
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context, sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, MAX_JOIN_TIME, player.getMainHandler(), player, DROPPED_FRAME_NOTIFICATION_AMOUNT);
    EMMediaCodecAudioTrackRenderer audioRenderer = new EMMediaCodecAudioTrackRenderer(sampleSource, MediaCodecSelector.DEFAULT, null, true,
            player.getMainHandler(), player, AudioCapabilities.getCapabilities(context), streamType);
    TrackRenderer captionsRenderer = new TextTrackRenderer(sampleSource, player, player.getMainHandler().getLooper());


    //Create the Render list to send 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;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:android-tv-leanback    文件:PlayerActivity.java   
private void preparePlayer() {

        SampleSource sampleSource =
                new FrameworkSampleSource(this, Uri.parse(mVideo.getContentUrl()), /* headers */ null, RENDERER_COUNT);

        // Build the track renderers
        videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
        TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);


        // Setup the player
        player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
        player.addListener(this);
        // Build the player controls
        mediaController.setMediaPlayer(new PlayerControl(player));
        mediaController.setEnabled(true);
        player.prepare(videoRenderer, audioRenderer);
    }
项目:android-tv-leanback    文件:PlayerActivity.java   
private void preparePlayer() {

        SampleSource sampleSource =
                new FrameworkSampleSource(this, Uri.parse(mVideo.getContentUrl()), /* headers */ null, RENDERER_COUNT);

        // Build the track renderers
        videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
        TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

        // Setup the player
        player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
        player.addListener(this);
        // Build the player controls
        mediaController.setMediaPlayer(new PlayerControl(player));
        mediaController.setEnabled(true);
        player.prepare(videoRenderer, audioRenderer);
    }
项目:android-tv-leanback    文件:PlayerActivity.java   
private void preparePlayer() {

        SampleSource sampleSource =
                new FrameworkSampleSource(this, Uri.parse(mVideo.getContentUrl()), /* headers */ null, RENDERER_COUNT);

        // Build the track renderers
        videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
        TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

        // Setup the player
        player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
        player.addListener(this);
        // Build the player controls
        mediaController.setMediaPlayer(new PlayerControl(player));
        mediaController.setEnabled(true);
        player.prepare(videoRenderer, audioRenderer);
    }
项目:android-tv-leanback    文件:PlayerActivity.java   
private void preparePlayer() {

        SampleSource sampleSource =
                new FrameworkSampleSource(this, Uri.parse(mVideo.getContentUrl()), /* headers */ null, RENDERER_COUNT);

        // Build the track renderers
        videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
        TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

        // Setup the player
        player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
        player.addListener(this);
        // Build the player controls
        mediaController.setMediaPlayer(new PlayerControl(player));
        mediaController.setEnabled(true);
        player.prepare(videoRenderer, audioRenderer);
    }