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


Java DefaultBandwidthMeter類代碼示例

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


DefaultBandwidthMeter類屬於com.google.android.exoplayer2.upstream包,在下文中一共展示了DefaultBandwidthMeter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createFullPlayer

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
/***
 * 創建實例播放實例,並不開始緩衝
 **/
private SimpleExoPlayer createFullPlayer() {
    TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
    BufferingLoadControl loadControl = new BufferingLoadControl();
    if (null == modelType) {
        setDefaultLoadModel();
    } else {
        loadControl.setListener(new LoadListener() {
            @Override
            public void onProgress(long pro) {
                getPlayerViewListener().showNetSpeed(String.valueOf(pro) + "%");
            }
        });
    }
    DefaultRenderersFactory rf = new DefaultRenderersFactory(activity, drmSessionManager, DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON);
    SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(rf, trackSelector, loadControl);
    player.setPlaybackParameters(playbackParameters);
    getPlayerViewListener().setPlayer(player);
    return player;
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:24,代碼來源:ExoUserPlayer.java

示例2: onBind

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的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

示例3: onStart

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
@Override
public final void onStart(HostActivity host, Surface surface) {
  // Build the player.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
  trackSelector = buildTrackSelector(host, bandwidthMeter);
  String userAgent = "ExoPlayerPlaybackTests";
  DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = buildDrmSessionManager(userAgent);
  player = buildExoPlayer(host, surface, trackSelector, drmSessionManager);
  player.prepare(buildSource(host, Util.getUserAgent(host, userAgent), bandwidthMeter));
  player.addListener(this);
  player.setAudioDebugListener(this);
  player.setVideoDebugListener(this);
  player.setPlayWhenReady(true);
  actionHandler = new Handler();
  // Schedule any pending actions.
  if (pendingSchedule != null) {
    pendingSchedule.start(player, trackSelector, actionHandler);
    pendingSchedule = null;
  }
}
 
開發者ID:ashwanijanghu,項目名稱:ExoPlayer-Offline,代碼行數:21,代碼來源:ExoHostedTest.java

示例4: setExoViewSource

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的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

示例5: setupExoPlayer

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
private void setupExoPlayer() {
    TrackSelection.Factory adaptiveTrackSelectionFactory =
            new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());

    exoPlayer = ExoPlayerFactory.newSimpleInstance(
            new DefaultRenderersFactory(this),
            new DefaultTrackSelector(adaptiveTrackSelectionFactory),
            new DefaultLoadControl());
    pvVideoPreview.setPlayer(exoPlayer);
    exoPlayer.setPlayWhenReady(true);

    Uri uri = Uri.parse("asset:///sample_video.mp4");
    MediaSource mediaSource = createMediaSource(this, uri);
    LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource);
    exoPlayer.prepare(loopingMediaSource, true, false);
}
 
開發者ID:akexorcist,項目名稱:Android-O-Feature,代碼行數:17,代碼來源:PictureInPictureActivity.java

示例6: initExoPlayer

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
private void initExoPlayer(MediaSource sampleSource) {
  if (exoPlayer == null) {
    TrackSelection.Factory videoTrackSelectionFactory =
        new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

    // 2. Create the player
    exoPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
  }

  exoPlayer.prepare(sampleSource);

  exoPlayer.setVideoSurfaceView(svPlayer);

  exoPlayer.setPlayWhenReady(true);

  initMediaControls();
}
 
開發者ID:Foso,項目名稱:ExoPlayer-with-MediaControls,代碼行數:19,代碼來源:MainActivity.java

示例7: initializePlayer

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
private void initializePlayer() {
    BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
    TrackSelection.Factory videoTrackSelectionFactory =
            new AdaptiveTrackSelection.Factory(bandwidthMeter);
    mTrackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

    mPlayer = ExoPlayerFactory.newSimpleInstance(getActivity(), mTrackSelector);
    mPlayerAdapter = new LeanbackPlayerAdapter(getActivity(), mPlayer, UPDATE_DELAY);
    mPlaylistActionListener = new PlaylistActionListener(mPlaylist);
    mPlayerGlue = new VideoPlayerGlue(getActivity(), mPlayerAdapter, mPlaylistActionListener);
    mPlayerGlue.setHost(new VideoFragmentGlueHost(this));
    mPlayerGlue.playWhenPrepared();

    play(mVideo);

    ArrayObjectAdapter mRowsAdapter = initializeRelatedVideosRow();
    setAdapter(mRowsAdapter);
}
 
開發者ID:googlesamples,項目名稱:androidtv-Leanback,代碼行數:19,代碼來源:PlaybackFragment.java

示例8: createDataSource

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
@Override
public DataSource createDataSource() {
    if (null != mCipher) {
        return new MyDefaultDataSource(context, mCipher, mSecretKeySpec, mIvParameterSpec, mTransferListener, baseDataSourceFactory.createDataSource());
    } else if (key != null) {
        return new Encrypted1FileDataSource(key, new DefaultBandwidthMeter());
    } else {
        return new DefaultDataSource(context, new DefaultBandwidthMeter(), baseDataSourceFactory.createDataSource());
    }
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:11,代碼來源:EncryptedFileDataSourceFactory.java

示例9: createPlayer

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
private static SimpleExoPlayer createPlayer(Context context) {
    BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
    TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

    return ExoPlayerFactory.newSimpleInstance(context.getApplicationContext(), trackSelector);
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:8,代碼來源:ExoVideoPlayer.java

示例10: onCreate

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的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

示例11: startPlayer

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
/**
 * 播放啟動視頻
 */
private void startPlayer() {
    // 0.  set player view
    playerView = (SimpleExoPlayerView) findViewById(R.id.playerView);
    playerView.setUseController(false);
    playerView.getKeepScreenOn();
    playerView.setResizeMode(RESIZE_MODE_FILL);

    // 1. Create a default TrackSelector
    TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());
    trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

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

    // 3. Create the mPlayer
    mPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);
    mPlayer.addListener(this);

    // 4. set player
    playerView.setPlayer(mPlayer);
    mPlayer.setPlayWhenReady(true);

    // 5. prepare to play
    File file = new File(Constants.FILE_VIDEO_FLODER, "jcode.mp4");
    if (file.isFile() && file.exists()) {
        mUri = Uri.fromFile(file);
    } else {
        Toast.makeText(this,"文件未找到",Toast.LENGTH_SHORT).show();
        return;
    }
    ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
    DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, "UserAgent");
    videoSource = new ExtractorMediaSource(mUri, dataSourceFactory, extractorsFactory, null, null);

    // 6. ready to play
    mPlayer.prepare(videoSource);
}
 
開發者ID:hiliving,項目名稱:P2Video-master,代碼行數:41,代碼來源:PlayerActivity.java

示例12: PlayerController

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
public PlayerController(Context context) {
    this.bandwidthMeter = new DefaultBandwidthMeter();
    this.loadControl = new DefaultLoadControl();
    this.extractorsFactory = new DefaultExtractorsFactory();
    this.trackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
    this.dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context.getApplicationContext(), TAG_NAME), (TransferListener<? super DataSource>) bandwidthMeter);
    this.trackSelector = new DefaultTrackSelector(trackSelectionFactory);
    this.player = ExoPlayerFactory.newSimpleInstance(context, this.trackSelector, this.loadControl);
    this.playerView = new PlayerView(context,this.player);
}
 
開發者ID:herudi,項目名稱:react-native-exoplayer-intent-video,代碼行數:11,代碼來源:PlayerController.java

示例13: ExoPlayerInstance

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的package包/類
private ExoPlayerInstance() {
    this.context = ExpressApplication.getApplication();
    DefaultBandwidthMeter defaultBandwidthMeter = new DefaultBandwidthMeter();
    mainHandler = new Handler();
    defaultExtractorsFactory = new DefaultExtractorsFactory();
    mediaDataSourceFactory = new DefaultDataSourceFactory(context, defaultBandwidthMeter,
            new OkHttpDataSourceFactory(new OkHttpClient.Builder().build(),
                    Util.getUserAgent(context, "Tumbviewer"),
                    defaultBandwidthMeter, CacheControl.FORCE_NETWORK));
    TrackSelection.Factory factory = new AdaptiveTrackSelection.Factory(defaultBandwidthMeter);
    trackSelector = new DefaultTrackSelector(factory);
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:13,代碼來源:ExoPlayerInstance.java

示例14: createFullPlayer

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的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

示例15: createFullPlayer

import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; //導入依賴的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


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