本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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());
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
}
示例14: EventLogger
import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public EventLogger() {
window = new Timeline.Window();
period = new Timeline.Period();
startTimeMs = SystemClock.elapsedRealtime();
}
示例15: EventLogger
import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public EventLogger() {
window = new Timeline.Window();
period = new Timeline.Period();
startTimeMs = SystemClock.elapsedRealtime();
}