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


Java Timeline.Window方法代碼示例

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


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

示例1: createViews

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private void createViews() {
    mediaDataSourceFactory = buildDataSourceFactory(true);
    mainHandler = new Handler();
    window = new Timeline.Window();
    if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
        CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
    }

    LayoutParams layoutParams = new LayoutParams(
            LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);
    exoPlayerView = new ExoPlayerView(getContext());
    exoPlayerView.setLayoutParams(layoutParams);

    addView(exoPlayerView, 0, layoutParams);
}
 
開發者ID:12d,項目名稱:react-native-videoplayer,代碼行數:17,代碼來源:ReactExoplayerView.java

示例2: canShowMultiWindowTimeBar

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
/**
 * Returns whether the specified {@code timeline} can be shown on a multi-window time bar.
 *
 * @param timeline The {@link Timeline} to check.
 * @param window   A scratch {@link Timeline.Window} instance.
 * @return Whether the specified timeline can be shown on a multi-window time bar.
 */
private static boolean canShowMultiWindowTimeBar(Timeline timeline, Timeline.Window window) {
    if (timeline.getWindowCount() > MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR) {
        return false;
    }
    int windowCount = timeline.getWindowCount();
    for (int i = 0; i < windowCount; i++) {
        if (timeline.getWindow(i, window).durationUs == C.TIME_UNSET) {
            return false;
        }
    }
    return true;
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:20,代碼來源:PlaybackControlView.java

示例3: MergingMediaSource

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
/**
 * @param mediaSources The {@link MediaSource}s to merge.
 */
public MergingMediaSource(MediaSource... mediaSources) {
  this.mediaSources = mediaSources;
  pendingTimelineSources = new ArrayList<>(Arrays.asList(mediaSources));
  window = new Timeline.Window();
  periodCount = PERIOD_COUNT_UNSET;
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:10,代碼來源:MergingMediaSource.java

示例4: ExoVideoPlaybackControlView

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public ExoVideoPlaybackControlView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    rewindMs = DEFAULT_REWIND_MS;
    fastForwardMs = DEFAULT_FAST_FORWARD_MS;
    showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;


    if (attrs != null) {
        TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ExoVideoPlaybackControlView, 0, 0);

        try {
            rewindMs = typedArray.getInt(R.styleable.ExoVideoPlaybackControlView_rewindIncrement, rewindMs);
            fastForwardMs = typedArray.getInt(R.styleable.ExoVideoPlaybackControlView_fastForwardIncrement, fastForwardMs);
            showTimeoutMs = typedArray.getInt(R.styleable.ExoVideoPlaybackControlView_showTimeout, showTimeoutMs);
        } finally {
            typedArray.recycle();
        }
    }

    formatBuilder = new StringBuilder();
    formatter = new Formatter(formatBuilder, Locale.getDefault());
    currentWindow = new Timeline.Window();
    componentListener = new ComponentListener();

    window = new Timeline.Window();


    LayoutInflater.from(context).inflate(R.layout.exo_playback_control_view, this);

    findViews();
    initViews();
    initOrientationListener();
    showPortraitOrLandscape();
    updateTime();
}
 
開發者ID:JarvanMo,項目名稱:ExoPlayerVideoView,代碼行數:37,代碼來源:ExoVideoPlaybackControlView.java

示例5: onCreate

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        shouldAutoPlay = true;
        mediaDataSourceFactory = buildDataSourceFactory(true);
        mainHandler = new Handler();
        window = new Timeline.Window();
        if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
            CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
        }

        setContentView(R.layout.player_activity_v2);
//        View rootView = findViewById(root);

        simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
//        simpleExoPlayerView.setControllerVisibilityListener(this);
        simpleExoPlayerView.requestFocus();

        /**不使用ExoPlayer自帶的mediaController**/
        simpleExoPlayerView.setUseController(false);

        controller = (MediaControlView) findViewById(R.id.player_control);
        controller.setVisibilityListener(new MediaControlView.VisibilityListener() {
            @Override
            public void onVisibilityChange(int visibility) {

            }
        });
        EventBus.getDefault().register(this);
    }
 
開發者ID:AndroidTips,項目名稱:MDVideo,代碼行數:31,代碼來源:PlayerActivityV2.java

示例6: onCreate

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video_player);

    shouldAutoPlay = true;
    bandwidthMeter = new DefaultBandwidthMeter();
    mediaDataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, "mediaPlayerSample"), (TransferListener<? super DataSource>) bandwidthMeter);
    window = new Timeline.Window();
    ivHideControllerButton = (ImageView) findViewById(R.id.exo_controller);

}
 
開發者ID:yusufcakmak,項目名稱:ExoPlayerSample,代碼行數:13,代碼來源:VideoPlayerActivity.java

示例7: onCreate

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  shouldAutoPlay = true;
  mediaDataSourceFactory = buildDataSourceFactory(true);
  mainHandler = new Handler();
  window = new Timeline.Window();
  if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
    CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
  }

  setContentView(R.layout.player_activity);
  View rootView = findViewById(R.id.root);
  rootView.setOnClickListener(this);
  debugRootView = (LinearLayout) findViewById(R.id.controls_root);
  debugTextView = (TextView) findViewById(R.id.debug_text_view);
  retryButton = (Button) findViewById(R.id.retry_button);
  retryButton.setOnClickListener(this);

  simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
  simpleExoPlayerView.setControllerVisibilityListener(this);
  simpleExoPlayerView.requestFocus();

  String title = getIntent().getStringExtra(PLAYER_TITLE);
  setTitle(title);
  tracker.setScreenName("播放器: " + title);
  tracker.send(new HitBuilders.ScreenViewBuilder().build());
}
 
開發者ID:TakumaMochizuki,項目名稱:Komica,代碼行數:29,代碼來源:PlayerActivity.java

示例8: initPlayer

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private void initPlayer(String url) {
        // 1.創建一個默認TrackSelector,測量播放過程中的帶寬。 如果不需要,可以為null。
        DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        //從MediaSource中選出media提供給可用的Render S來渲染,在創建播放器時被注入
        TrackSelection.Factory videoTrackSelectionFactory =
                new AdaptiveTrackSelection.Factory(bandwidthMeter);
        TrackSelector trackSelector =
                new DefaultTrackSelector(videoTrackSelectionFactory);
        // 2.創建一個默認的LoadControl
        //Create a default LoadControl 控製MediaSource緩存media
        DefaultLoadControl loadControl = new DefaultLoadControl();
//        BufferingLoadControl bufferingLoadControl = new BufferingLoadControl();
        //生成加載媒體數據的DataSource實例。
//        dataSourceFactory = new DefaultDataSourceFactory(this,
//                Util.getUserAgent(this, "aitrip"), bandwidthMeter);
        //自定義解密工廠
        aitripFactory = new AitripDataSourceFactory(this,
                Util.getUserAgent(this, "aitrip"), bandwidthMeter);
        extractorsFactory = new DefaultExtractorsFactory();
//        factory = new DiyExtractorsFactory();
        FileDataSource fileDataSource = new FileDataSource();
        //test mp3
//        url = "https://storage.googleapis.com/exoplayer-test-media-0/play.mp3";
        // MediaSource代表要播放的媒體。
        videoSource = new ExtractorMediaSource(Uri.parse(url),
                aitripFactory, extractorsFactory, null, null);
        // 3.創建播放器
        player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);

        //SimpleExoPlayerView simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.exo_player);
        //設置監聽器
        player.addListener(eventListener);
        //裝載多個資源
        MediaSource[] mediaSources = new MediaSource[1];
//        mediaSources[0] = buildMediaSource(Uri.parse(huai), "");
//        mediaSources[1] = buildMediaSource(Uri.parse(deng), "");
        mediaSources[0] = buildMediaSource(Uri.parse(deng), "");
//        mediaSources[2] = buildMediaSource(playerUri, "");
//        mediaSources[3] = buildMediaSource(Uri.parse(deng), "");
        ConcatenatingMediaSource mediaSource = new ConcatenatingMediaSource(mediaSources);

        //設置資源
        player.prepare(mediaSource);
        window = new Timeline.Window();
    }
 
開發者ID:ChangWeiBa,項目名稱:AesExoPlayer,代碼行數:46,代碼來源:TestPlayerActivity.java

示例9: EventLogger

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public EventLogger(@Nullable MappingTrackSelector trackSelector) {
  this.trackSelector = trackSelector;
  window = new Timeline.Window();
  period = new Timeline.Period();
  startTimeMs = SystemClock.elapsedRealtime();
}
 
開發者ID:Tubitv,項目名稱:TubiPlayer,代碼行數:7,代碼來源:EventLogger.java

示例10: EventLogger

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public EventLogger(MappingTrackSelector trackSelector) {
  this.trackSelector = trackSelector;
  window = new Timeline.Window();
  period = new Timeline.Period();
  startTimeMs = SystemClock.elapsedRealtime();
}
 
開發者ID:ashwanijanghu,項目名稱:ExoPlayer-Offline,代碼行數:7,代碼來源:EventLogger.java

示例11: init

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private void init(Context context) {
        showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;

        formatBuilder = new StringBuilder();
        formatter = new Formatter(formatBuilder, Locale.getDefault());
        currentWindow = new Timeline.Window();
        componentListener = new ComponentListener();

        LayoutInflater.from(context).inflate(R.layout.item_video_control, this);
        controlLayout = (LinearLayout) findViewById(R.id.video_control_layout);
        time = (TextView) findViewById(R.id.time);
        timeCurrent = (TextView) findViewById(R.id.time_current);
        fullscreen = (ImageView) findViewById(R.id.video_fullscreen);
        fullscreen.setOnClickListener(componentListener);
        progressBar = (SeekBar) findViewById(R.id.video_controller_progress);
        progressBar.setOnSeekBarChangeListener(componentListener);
        progressBar.setMax(PROGRESS_BAR_MAX);

        videoView = new TextureView(context);
        FrameLayout.LayoutParams videoParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        videoView.setLayoutParams(videoParams);
        videoView.setOnClickListener(componentListener);

        thumbnailView = new SimpleDraweeView(context);
        FrameLayout.LayoutParams thumbParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
                .setPlaceholderImage(R.color.loading_color)
                .build();
        thumbnailView.setHierarchy(hierarchy);
        thumbnailView.setLayoutParams(thumbParams);

        loadingBar = new ProgressBar(context, null, android.R.attr.progressBarStyle);
        FrameLayout.LayoutParams loadingParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        loadingParams.gravity = Gravity.CENTER;
        loadingBar.setLayoutParams(loadingParams);
        loadingBar.setVisibility(GONE);

        playView = new ImageView(context);
        FrameLayout.LayoutParams playParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        playParams.gravity = Gravity.CENTER;
        playView.setLayoutParams(playParams);
        int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
                context.getResources().getDisplayMetrics());
        playView.setPadding(padding, padding, padding, padding);
        playView.setOnClickListener(componentListener);

//        setOnClickListener(componentListener);
        leftTime = new TextView(context);
        FrameLayout.LayoutParams leftParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        leftParams.gravity = Gravity.BOTTOM;
        leftParams.bottomMargin = padding / 2;
        leftParams.leftMargin = padding / 2;
        leftTime.setLayoutParams(leftParams);
        leftTime.setTextColor(Color.WHITE);
        leftTime.setVisibility(GONE);

        addView(videoView, 0);
        addView(thumbnailView, 1);
        addView(loadingBar, 2);
        addView(playView, 3);
        addView(leftTime, 4);
    }
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:68,代碼來源:CommonExoPlayerView.java

示例12: EventLogger

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public EventLogger(MappingTrackSelector trackSelector) {
    this.trackSelector = trackSelector;
    window = new Timeline.Window();
    period = new Timeline.Period();
    startTimeMs = SystemClock.elapsedRealtime();
}
 
開發者ID:huyongli,項目名稱:TigerVideo,代碼行數:7,代碼來源:EventLogger.java

示例13: PlaybackControlView

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public PlaybackControlView(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);

  int controllerLayoutId = R.layout.exo_playback_control_view;
  rewindMs = DEFAULT_REWIND_MS;
  fastForwardMs = DEFAULT_FAST_FORWARD_MS;
  showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;
  if (attrs != null) {
    TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
        R.styleable.PlaybackControlView, 0, 0);
    try {
      rewindMs = a.getInt(R.styleable.PlaybackControlView_rewind_increment, rewindMs);
      fastForwardMs = a.getInt(R.styleable.PlaybackControlView_fastforward_increment,
          fastForwardMs);
      showTimeoutMs = a.getInt(R.styleable.PlaybackControlView_show_timeout, showTimeoutMs);
      controllerLayoutId = a.getResourceId(R.styleable.PlaybackControlView_controller_layout_id,
          controllerLayoutId);
    } finally {
      a.recycle();
    }
  }
  currentWindow = new Timeline.Window();
  formatBuilder = new StringBuilder();
  formatter = new Formatter(formatBuilder, Locale.getDefault());
  componentListener = new ComponentListener();
  seekDispatcher = DEFAULT_SEEK_DISPATCHER;

  LayoutInflater.from(context).inflate(controllerLayoutId, this);
  setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);

  durationView = (TextView) findViewById(R.id.exo_duration);
  positionView = (TextView) findViewById(R.id.exo_position);
  progressBar = (SeekBar) findViewById(R.id.exo_progress);
  if (progressBar != null) {
    progressBar.setOnSeekBarChangeListener(componentListener);
    progressBar.setMax(PROGRESS_BAR_MAX);
  }
  playButton = findViewById(R.id.exo_play);
  if (playButton != null) {
    playButton.setOnClickListener(componentListener);
  }
  pauseButton = findViewById(R.id.exo_pause);
  if (pauseButton != null) {
    pauseButton.setOnClickListener(componentListener);
  }
  previousButton = findViewById(R.id.exo_prev);
  if (previousButton != null) {
    previousButton.setOnClickListener(componentListener);
  }
  nextButton = findViewById(R.id.exo_next);
  if (nextButton != null) {
    nextButton.setOnClickListener(componentListener);
  }
  rewindButton = findViewById(R.id.exo_rew);
  if (rewindButton != null) {
    rewindButton.setOnClickListener(componentListener);
  }
  fastForwardButton = findViewById(R.id.exo_ffwd);
  if (fastForwardButton != null) {
    fastForwardButton.setOnClickListener(componentListener);
  }
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:63,代碼來源:PlaybackControlView.java

示例14: EventLogger

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public EventLogger() {
  window = new Timeline.Window();
  period = new Timeline.Period();
  startTimeMs = SystemClock.elapsedRealtime();
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:6,代碼來源:EventLogger.java

示例15: EventLogger

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public EventLogger() {
    window = new Timeline.Window();
    period = new Timeline.Period();
    startTimeMs = SystemClock.elapsedRealtime();
}
 
開發者ID:AndroidTips,項目名稱:MDVideo,代碼行數:6,代碼來源:EventLogger.java


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