當前位置: 首頁>>代碼示例>>Java>>正文


Java ExoPlayerFactory.newInstance方法代碼示例

本文整理匯總了Java中com.google.android.exoplayer2.ExoPlayerFactory.newInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java ExoPlayerFactory.newInstance方法的具體用法?Java ExoPlayerFactory.newInstance怎麽用?Java ExoPlayerFactory.newInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.exoplayer2.ExoPlayerFactory的用法示例。


在下文中一共展示了ExoPlayerFactory.newInstance方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import com.google.android.exoplayer2.ExoPlayerFactory; //導入方法依賴的package包/類
@Override
public void run() {
  Looper.prepare();
  LibvpxVideoRenderer videoRenderer = new LibvpxVideoRenderer(true, 0);
  DefaultTrackSelector trackSelector = new DefaultTrackSelector();
  player = ExoPlayerFactory.newInstance(new Renderer[] {videoRenderer}, trackSelector);
  player.addListener(this);
  ExtractorMediaSource mediaSource = new ExtractorMediaSource(
      uri,
      new DefaultDataSourceFactory(context, "ExoPlayerExtVp9Test"),
      MatroskaExtractor.FACTORY,
      null,
      null);
  player.sendMessages(new ExoPlayer.ExoPlayerMessage(videoRenderer,
      LibvpxVideoRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER,
      new VpxVideoSurfaceView(context)));
  player.prepare(mediaSource);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
開發者ID:TakumaMochizuki,項目名稱:Komica,代碼行數:21,代碼來源:VpxPlaybackTest.java

示例2: run

import com.google.android.exoplayer2.ExoPlayerFactory; //導入方法依賴的package包/類
@Override
public void run() {
  Looper.prepare();
  LibopusAudioRenderer audioRenderer = new LibopusAudioRenderer();
  DefaultTrackSelector trackSelector = new DefaultTrackSelector();
  player = ExoPlayerFactory.newInstance(new Renderer[] {audioRenderer}, trackSelector);
  player.addListener(this);
  ExtractorMediaSource mediaSource = new ExtractorMediaSource(
      uri,
      new DefaultDataSourceFactory(context, "ExoPlayerExtOpusTest"),
      MatroskaExtractor.FACTORY,
      null,
      null);
  player.prepare(mediaSource);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
開發者ID:TakumaMochizuki,項目名稱:Komica,代碼行數:18,代碼來源:OpusPlaybackTest.java

示例3: run

import com.google.android.exoplayer2.ExoPlayerFactory; //導入方法依賴的package包/類
@Override
public void run() {
  Looper.prepare();
  LibflacAudioRenderer audioRenderer = new LibflacAudioRenderer();
  DefaultTrackSelector trackSelector = new DefaultTrackSelector();
  player = ExoPlayerFactory.newInstance(new Renderer[] {audioRenderer}, trackSelector);
  player.addListener(this);
  ExtractorMediaSource mediaSource = new ExtractorMediaSource(
      uri,
      new DefaultDataSourceFactory(context, "ExoPlayerExtFlacTest"),
      MatroskaExtractor.FACTORY,
      null,
      null);
  player.prepare(mediaSource);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
開發者ID:TakumaMochizuki,項目名稱:Komica,代碼行數:18,代碼來源:FlacPlaybackTest.java

示例4: ExoMediaPlayer

import com.google.android.exoplayer2.ExoPlayerFactory; //導入方法依賴的package包/類
public ExoMediaPlayer(@NonNull Context context) {
    this.context = context;

    bufferRepeater.setRepeaterDelay(BUFFER_REPEAT_DELAY);
    bufferRepeater.setRepeatListener(new BufferRepeatListener());

    mainHandler = new Handler();

    ComponentListener componentListener = new ComponentListener();
    RendererProvider rendererProvider = new RendererProvider(context, mainHandler, componentListener, componentListener, componentListener, componentListener);
    rendererProvider.setDrmSessionManager(generateDrmSessionManager());

    renderers = rendererProvider.generate();

    adaptiveTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
    trackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory);

    LoadControl loadControl = ExoMedia.Data.loadControl != null ? ExoMedia.Data.loadControl : new DefaultLoadControl();
    player = ExoPlayerFactory.newInstance(renderers.toArray(new Renderer[renderers.size()]), trackSelector, loadControl);
    player.addListener(this);
}
 
開發者ID:brianwernick,項目名稱:ExoMedia,代碼行數:22,代碼來源:ExoMediaPlayer.java

示例5: run

import com.google.android.exoplayer2.ExoPlayerFactory; //導入方法依賴的package包/類
@Override
public void run() {
  Looper.prepare();
  LibvpxVideoRenderer videoRenderer = new LibvpxVideoRenderer(true, 0);
  DefaultTrackSelector trackSelector = new DefaultTrackSelector();
  player = ExoPlayerFactory.newInstance(new Renderer[] {videoRenderer}, trackSelector);
  player.addListener(this);
  MediaSource mediaSource =
      new ExtractorMediaSource.Factory(
              new DefaultDataSourceFactory(context, "ExoPlayerExtVp9Test"))
          .setExtractorsFactory(MatroskaExtractor.FACTORY)
          .createMediaSource(uri);
  player.sendMessages(new ExoPlayer.ExoPlayerMessage(videoRenderer,
      LibvpxVideoRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER,
      new VpxVideoSurfaceView(context)));
  player.prepare(mediaSource);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:20,代碼來源:VpxPlaybackTest.java

示例6: run

import com.google.android.exoplayer2.ExoPlayerFactory; //導入方法依賴的package包/類
@Override
public void run() {
  Looper.prepare();
  LibopusAudioRenderer audioRenderer = new LibopusAudioRenderer();
  DefaultTrackSelector trackSelector = new DefaultTrackSelector();
  player = ExoPlayerFactory.newInstance(new Renderer[] {audioRenderer}, trackSelector);
  player.addListener(this);
  MediaSource mediaSource =
      new ExtractorMediaSource.Factory(
              new DefaultDataSourceFactory(context, "ExoPlayerExtOpusTest"))
          .setExtractorsFactory(MatroskaExtractor.FACTORY)
          .createMediaSource(uri);
  player.prepare(mediaSource);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:17,代碼來源:OpusPlaybackTest.java

示例7: run

import com.google.android.exoplayer2.ExoPlayerFactory; //導入方法依賴的package包/類
@Override
public void run() {
  Looper.prepare();
  LibflacAudioRenderer audioRenderer = new LibflacAudioRenderer();
  DefaultTrackSelector trackSelector = new DefaultTrackSelector();
  player = ExoPlayerFactory.newInstance(new Renderer[] {audioRenderer}, trackSelector);
  player.addListener(this);
  MediaSource mediaSource =
      new ExtractorMediaSource.Factory(
              new DefaultDataSourceFactory(context, "ExoPlayerExtFlacTest"))
          .setExtractorsFactory(MatroskaExtractor.FACTORY)
          .createMediaSource(uri);
  player.prepare(mediaSource);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
開發者ID:y20k,項目名稱:transistor,代碼行數:17,代碼來源:FlacPlaybackTest.java

示例8: createExoPlayerImpl

import com.google.android.exoplayer2.ExoPlayerFactory; //導入方法依賴的package包/類
protected ExoPlayer createExoPlayerImpl(Renderer[] renderers, TrackSelector trackSelector,
                                        LoadControl loadControl) {
  return ExoPlayerFactory.newInstance(renderers, trackSelector, loadControl);
}
 
開發者ID:CarGuo,項目名稱:GSYVideoPlayer,代碼行數:5,代碼來源:SimpleExoPlayer2.java


注:本文中的com.google.android.exoplayer2.ExoPlayerFactory.newInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。