本文整理汇总了Java中com.google.android.exoplayer2.ui.SimpleExoPlayerView.setControllerVisibilityListener方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleExoPlayerView.setControllerVisibilityListener方法的具体用法?Java SimpleExoPlayerView.setControllerVisibilityListener怎么用?Java SimpleExoPlayerView.setControllerVisibilityListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.exoplayer2.ui.SimpleExoPlayerView
的用法示例。
在下文中一共展示了SimpleExoPlayerView.setControllerVisibilityListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.google.android.exoplayer2.ui.SimpleExoPlayerView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
shouldAutoPlay = true;
clearResumePosition();
mediaDataSourceFactory = buildDataSourceFactory(true);
mainHandler = new Handler();
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();
}
示例2: PlayerView
import com.google.android.exoplayer2.ui.SimpleExoPlayerView; //导入方法依赖的package包/类
public PlayerView(Context context, SimpleExoPlayer player) {
super(context);
simpleExoPlayerView = new SimpleExoPlayerView(context);
progressBar = new ProgressBar(context);
textView = new TextView(context);
textView.setX(40);
textView.setY(20);
textView.setTextColor(Color.parseColor("#FFFFFF"));
textView.setTextSize(16);
textView.setText("By Herudi");
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(100,100);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
simpleExoPlayerView.setLayoutParams(new SimpleExoPlayerView.LayoutParams(
SimpleExoPlayerView.LayoutParams.MATCH_PARENT,
SimpleExoPlayerView.LayoutParams.MATCH_PARENT
));
setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT
));
setBackgroundColor(ContextCompat.getColor(context, android.R.color.black));
addView(simpleExoPlayerView);
addView(textView);
addView(progressBar,params);
simpleExoPlayerView.setUseController(true);
simpleExoPlayerView.requestFocus();
simpleExoPlayerView.setPlayer(player);
simpleExoPlayerView.setControllerVisibilityListener(new PlaybackControlView.VisibilityListener() {
@Override
public void onVisibilityChange(int visibility) {
if (visibility==0){
textView.setVisibility(VISIBLE);
}else {
textView.setVisibility(GONE);
}
}
});
}
示例3: onCreate
import com.google.android.exoplayer2.ui.SimpleExoPlayerView; //导入方法依赖的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());
}