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


Java LoadControl类代码示例

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


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

示例1: onBind

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
@Override
public IBinder onBind(final Intent intent) {

    bandwidthMeter = new DefaultBandwidthMeter();
    TrackSelection.Factory videoTrackSelectionFactory =
            new AdaptiveTrackSelection.Factory(bandwidthMeter);

    dataSourceFactory = new DefaultDataSourceFactory(this,
            Util.getUserAgent(this, "SyncPlayer"), bandwidthMeter);

    extractorsFactory = new DefaultExtractorsFactory();

    TrackSelector trackSelector =
            new DefaultTrackSelector(videoTrackSelectionFactory);

    LoadControl loadControl = new DefaultLoadControl();

    SimpleExoPlayer player =
            ExoPlayerFactory.newSimpleInstance(getApplicationContext(), trackSelector, loadControl);
    mMediaPlayer = player;

    setCompletionListener();
    nbuilder.setSmallIcon(R.mipmap.ic_launcher);
    return mBinder;
}
 
开发者ID:mo3rfan,项目名称:syncplayer,代码行数:26,代码来源:MediaService.java

示例2: initializePlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private void initializePlayer(Uri videoUri){
    if (mExoPlayer == null){
        TrackSelector trackSelector = new DefaultTrackSelector();
        LoadControl loadControl = new DefaultLoadControl();
        mExoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, loadControl);
        mExoPlayer.addListener(this);
        mExoPlayer.seekTo(currentPosition);
        mPlayerView.setPlayer(mExoPlayer);
        String userAgent = Util.getUserAgent(getContext(), "Tasty");
        MediaSource mediaSource = new ExtractorMediaSource(videoUri, new DefaultDataSourceFactory(
                getContext(), userAgent), new DefaultExtractorsFactory(), null, null);
        mExoPlayer.prepare(mediaSource);
        if (playWhenReady) mExoPlayer.setPlayWhenReady(true);
        else mExoPlayer.setPlayWhenReady(false);
    }
}
 
开发者ID:harrynp,项目名称:BakingApp,代码行数:17,代码来源:StepDetailFragment.java

示例3: setExoViewSource

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private void setExoViewSource(@NonNull MasterSecret masterSecret, @NonNull VideoSlide videoSource)
    throws IOException
{
  BandwidthMeter         bandwidthMeter             = new DefaultBandwidthMeter();
  TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
  TrackSelector          trackSelector              = new DefaultTrackSelector(videoTrackSelectionFactory);
  LoadControl            loadControl                = new DefaultLoadControl();

  exoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, loadControl);
  exoView.setPlayer(exoPlayer);

  DefaultDataSourceFactory    defaultDataSourceFactory    = new DefaultDataSourceFactory(getContext(), "GenericUserAgent", null);
  AttachmentDataSourceFactory attachmentDataSourceFactory = new AttachmentDataSourceFactory(getContext(), masterSecret, defaultDataSourceFactory, null);
  ExtractorsFactory           extractorsFactory           = new DefaultExtractorsFactory();

  MediaSource mediaSource = new ExtractorMediaSource(videoSource.getUri(), attachmentDataSourceFactory, extractorsFactory, null, null);

  exoPlayer.prepare(mediaSource);
  exoPlayer.setPlayWhenReady(true);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:21,代码来源:VideoPlayer.java

示例4: ExoMediaPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的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: FakeExoPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
public FakeExoPlayer(Renderer[] renderers, TrackSelector trackSelector,
    LoadControl loadControl) {
  this.renderers = renderers;
  this.trackSelector = trackSelector;
  this.loadControl = loadControl;
  this.eventListeners = new CopyOnWriteArraySet<>();
  Looper eventListenerLooper = Looper.myLooper();
  this.eventListenerHandler = new Handler(eventListenerLooper != null ? eventListenerLooper
      : Looper.getMainLooper());
  this.playbackThread = new HandlerThread("FakeExoPlayer Thread");
  playbackThread.start();
  this.playbackHandler = new Handler(playbackThread.getLooper());
  this.isStartingUp = true;
  this.isLoading = false;
  this.playbackState = Player.STATE_IDLE;
  this.durationUs = C.TIME_UNSET;
}
 
开发者ID:y20k,项目名称:transistor,代码行数:18,代码来源:FakeSimpleExoPlayer.java

示例6: ExoPlayerTestRunner

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private ExoPlayerTestRunner(PlayerFactory playerFactory, MediaSource mediaSource,
    RenderersFactory renderersFactory, MappingTrackSelector trackSelector,
    LoadControl loadControl, ActionSchedule actionSchedule, Player.EventListener eventListener) {
  this.playerFactory = playerFactory;
  this.mediaSource = mediaSource;
  this.renderersFactory = renderersFactory;
  this.trackSelector = trackSelector;
  this.loadControl = loadControl;
  this.actionSchedule = actionSchedule;
  this.eventListener = eventListener;
  this.timelines = new LinkedList<>();
  this.manifests = new LinkedList<>();
  this.periodIndices = new LinkedList<>();
  this.endedCountDownLatch = new CountDownLatch(1);
  this.playerThread = new HandlerThread("ExoPlayerTest thread");
  playerThread.start();
  this.handler = new Handler(playerThread.getLooper());
}
 
开发者ID:y20k,项目名称:transistor,代码行数:19,代码来源:ExoPlayerTestRunner.java

示例7: onCreate

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if (!isPlaying) {
        Handler mainHandler = new Handler();
        BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        TrackSelection.Factory videoTrackSelectionFactory =
                new AdaptiveVideoTrackSelection.Factory(bandwidthMeter);
        TrackSelector trackSelector =
                new DefaultTrackSelector(videoTrackSelectionFactory);

        LoadControl loadControl = new DefaultLoadControl();

        SimpleExoPlayer player =
                ExoPlayerFactory.newSimpleInstance(MainActivity.this, trackSelector, loadControl);
        SimpleExoPlayerView playerView = (SimpleExoPlayerView) findViewById(R.id.videoView);
        playerView.setPlayer(player);
        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(MainActivity.this,
                Util.getUserAgent(MainActivity.this, "yourApplicationName"));
        MediaSource mediaSource = new ExtractorMediaSource(Uri.parse("https://r7---sn-3c27ln7k.googlevideo.com/videoplayback?id=6fb497d0971b8cdf&itag=22&source=picasa&begin=0&requiressl=yes&mm=30&mn=sn-3c27ln7k&ms=nxu&mv=m&nh=IgphcjAzLmticDAxKgkxMjcuMC4wLjE&pl=22&sc=yes&mime=video/mp4&lmt=1486083166327499&mt=1486135406&ip=134.249.158.189&ipbits=8&expire=1486164239&sparams=ip,ipbits,expire,id,itag,source,requiressl,mm,mn,ms,mv,nh,pl,sc,mime,lmt&signature=3BB06D8D4294F8C49B3CE910B3D6849954302BB1.02ABE00700DFCEF715E72D0EFB73B67841E659F8&key=ck2&ratebypass=yes&title=%5BAnime365%5D%20Kuzu%20no%20Honkai%20-%2004%20(t1174045)"), dataSourceFactory,
                new DefaultExtractorsFactory(), null, null);
        player.prepare(mediaSource);
        player.setPlayWhenReady(true);

    }
}
 
开发者ID:CrazyDude1994,项目名称:lostfilm-android-client,代码行数:28,代码来源:MainActivity.java

示例8: initializePlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private void initializePlayer(Uri mediaUri) {
    if (mExoPlayer == null) {
        // Create an instance of the ExoPlayer.
        TrackSelector trackSelector = new DefaultTrackSelector();
        LoadControl loadControl = new DefaultLoadControl();
        mExoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, loadControl);
        binding.exoStepFragmentPlayerView.setPlayer(mExoPlayer);
        mExoPlayer.addListener(this);
        String userAgent = Util.getUserAgent(getContext(), "RecipeStepVideo");
        MediaSource mediaSource = new ExtractorMediaSource(mediaUri, new DefaultDataSourceFactory(
                getContext(), userAgent), new DefaultExtractorsFactory(), null, null);
        mExoPlayer.prepare(mediaSource);
        mExoPlayer.setPlayWhenReady(true);
    }
}
 
开发者ID:twisstosin,项目名称:UdacityBakingAndroid,代码行数:16,代码来源:StepFragment.java

示例9: setupPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private SimpleExoPlayer setupPlayer(){
	Log.d(TAG,"Setting up Player.");
	videoView.setKeepScreenOn(true);

	mUserAgent = Util.getUserAgent(getContext(), getResources().getString(R.string.app_name));

	AdaptiveTrackSelection.Factory trackSelectorFactory
			= new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
	DefaultTrackSelector trackSelector = new DefaultTrackSelector(trackSelectorFactory);
	LoadControl loadControl = new DefaultLoadControl();
	DefaultRenderersFactory renderersFactory
			= new DefaultRenderersFactory(getContext(), null, DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF);


	exoPlayer = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, loadControl);
	MyListener listener = new MyListener(exoPlayer, this);
	exoPlayer.addVideoListener(listener);
	exoPlayer.addListener(listener);

	exoPlayer.setPlayWhenReady(mPlaybackState);

	exoPlayer.prepare(buildMediaSource(Uri.parse(mRecording.getRecordingUrl()),""));
	return exoPlayer;
}
 
开发者ID:NiciDieNase,项目名称:chaosflix,代码行数:25,代码来源:ExoPlayerFragment.java

示例10: createFullPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private SimpleExoPlayer createFullPlayer() {
    TrackSelection.Factory videoTrackSelectionFactory
            = new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
    LoadControl loadControl = new DefaultLoadControl();
    SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(
            new DefaultRenderersFactory(playerView.getContext()),
            trackSelector, loadControl);
    player.setPlayWhenReady(true);
    player.prepare(mediaSourceBuilder.getMediaSource(false));
    player.addListener(eventListener);
    return player;
}
 
开发者ID:rubensousa,项目名称:PreviewSeekBar,代码行数:14,代码来源:ExoPlayerManager.java

示例11: createFullPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private SimpleExoPlayer createFullPlayer() {
    TrackSelection.Factory videoTrackSelectionFactory
            = new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
    LoadControl loadControl = new DefaultLoadControl();
    SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(
            new DefaultRenderersFactory(playerView.getContext()),
            trackSelector, loadControl);
    player.setPlayWhenReady(true);
    player.prepare(mediaSourceBuilder.getMediaSource(false));
    player.addListener(this);
    return player;
}
 
开发者ID:hongcwamazing,项目名称:PreviewSeekBar-master,代码行数:14,代码来源:ExoPlayerManager.java

示例12: createPreviewPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private SimpleExoPlayer createPreviewPlayer() {
    TrackSelection.Factory videoTrackSelectionFactory = new WorstVideoTrackSelection.Factory();
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
    LoadControl loadControl = new PreviewLoadControl();
    SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(
            new DefaultRenderersFactory(playerView.getContext()),
            trackSelector, loadControl);
    player.setPlayWhenReady(false);
    player.setVolume(0f);
    player.prepare(mediaSourceBuilder.getMediaSource(true));
    return player;
}
 
开发者ID:hongcwamazing,项目名称:PreviewSeekBar-master,代码行数:13,代码来源:ExoPlayerManager.java

示例13: setUpExoPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private void setUpExoPlayer() {
    // Create a default TrackSelector
    TrackSelector trackSelector = createTrackSelector();

    // Create a default LoadControl
    LoadControl loadControl = new DefaultLoadControl();

    // Create the player
    exoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, loadControl);
    resumeLocalVideo();

    exoPlayer.addListener(exoPlayerEventListener);
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:14,代码来源:VideoDetailsFragment.java

示例14: setUpExoPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private void setUpExoPlayer() {
    // Create a default TrackSelector
    TrackSelector trackSelector = createTrackSelector();

    // Create a default LoadControl
    LoadControl loadControl = new DefaultLoadControl();

    // Create the player
    exoPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);
    resumeLocalVideo();

    exoPlayer.addListener(exoPlayerEventListener);
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:14,代码来源:VideoPlayerActivity.java

示例15: createExoPlayer

import com.google.android.exoplayer2.LoadControl; //导入依赖的package包/类
private void createExoPlayer() {

        if (mExoPlayer != null) {
            releaseExoPlayer();
        }

        // create default TrackSelector
        TrackSelector trackSelector = new DefaultTrackSelector();

        // create default LoadControl - double the buffer
        LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE * 2));

        // create the player
        mExoPlayer = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(getApplicationContext()), trackSelector, loadControl);
    }
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:16,代码来源:PlayerService.java


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