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


Java PlaybackControlView类代码示例

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


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

示例1: PlayerView

import com.google.android.exoplayer2.ui.PlaybackControlView; //导入依赖的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);
            }
        }
    });
}
 
开发者ID:herudi,项目名称:react-native-exoplayer-intent-video,代码行数:39,代码来源:PlayerView.java

示例2: onCreate

import com.google.android.exoplayer2.ui.PlaybackControlView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setContentView(R.layout.activity_mediathek_player);
	ButterKnife.bind(this);

	// set to show
	//noinspection ConstantConditions
	show = (MediathekShow) getIntent().getExtras().getSerializable(EXTRA_SHOW);
	if (show == null) {
		Toast.makeText(this, R.string.error_mediathek_called_without_show, Toast.LENGTH_LONG).show();
		finish();
		return;
	}

	setSupportActionBar(toolbar);
	if (getSupportActionBar() != null) {
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		setTitle(show.getTopic());
		getSupportActionBar().setSubtitle(show.getTitle());
	}


	player = new Player(this, show, this, this);
	player.setView(videoView);
	updateSubtitleButtons();

	videoView.setControllerVisibilityListener(this);
	videoView.requestFocus();
	controlView = (PlaybackControlView) videoView.getChildAt(1);
}
 
开发者ID:cemrich,项目名称:zapp,代码行数:33,代码来源:MediathekPlayerActivity.java

示例3: onCreate

import com.google.android.exoplayer2.ui.PlaybackControlView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);
    ButterKnife.bind(this);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

    path = getIntent().getExtras().getString("MEDIA_URI");

    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });

    TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveVideoTrackSelection.Factory(null);
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
    LoadControl loadControl = new DefaultLoadControl();

    player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);

    playerView.setPlayer(player);

    DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, "org.polaric.cluttr"), null);
    ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
    MediaSource videoSource = new ExtractorMediaSource(Uri.parse(path), dataSourceFactory, extractorsFactory, null, null);

    player.prepare(videoSource);

    playerView.setControllerVisibilityListener(new PlaybackControlView.VisibilityListener() {
        @Override
        public void onVisibilityChange(int visibility) {
            if  (visibility==View.VISIBLE) {
                fab.show();
            } else {
                fab.hide();
            }
        }
    });
}
 
开发者ID:garretyoder,项目名称:Cluttr,代码行数:50,代码来源:VideoActivity.java

示例4: onControllerVisibilityChanges

import com.google.android.exoplayer2.ui.PlaybackControlView; //导入依赖的package包/类
private PlaybackControlView.VisibilityListener onControllerVisibilityChanges() {
    return visibility -> btnPictureInPicture.setVisibility(visibility);
}
 
开发者ID:akexorcist,项目名称:Android-O-Feature,代码行数:4,代码来源:PictureInPictureActivity.java

示例5: rewind

import com.google.android.exoplayer2.ui.PlaybackControlView; //导入依赖的package包/类
public void rewind() {
	player.seekTo(
		Math.max(player.getCurrentPosition() - PlaybackControlView.DEFAULT_REWIND_MS, 0)
	);
}
 
开发者ID:cemrich,项目名称:zapp,代码行数:6,代码来源:Player.java

示例6: fastForward

import com.google.android.exoplayer2.ui.PlaybackControlView; //导入依赖的package包/类
public void fastForward() {
	player.seekTo(
		Math.min(player.getCurrentPosition() + PlaybackControlView.DEFAULT_FAST_FORWARD_MS, player.getDuration())
	);
}
 
开发者ID:cemrich,项目名称:zapp,代码行数:6,代码来源:Player.java

示例7: ExoVideoView

import com.google.android.exoplayer2.ui.PlaybackControlView; //导入依赖的package包/类
@SuppressWarnings("WrongConstant")
    public ExoVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        boolean useTextureView = false;
        @SuperAspectRatioFrameLayout.ResizeMode
        int resizeMode = SuperAspectRatioFrameLayout.RESIZE_MODE_FIT;

        boolean portrait = true;

        int rewindMs = PlaybackControlView.DEFAULT_REWIND_MS;
        int fastForwardMs = ExoVideoPlaybackControlView.DEFAULT_FAST_FORWARD_MS;
        int controllerShowTimeoutMs = ExoVideoPlaybackControlView.DEFAULT_SHOW_TIMEOUT_MS;

        float textSize = Float.MIN_VALUE;

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

            try {
                useController = typedArray.getBoolean(R.styleable.ExoVideoView_useController, useController);
                useTextureView = typedArray.getBoolean(R.styleable.ExoVideoView_useTextureView, false);
                resizeMode = typedArray.getInt(R.styleable.ExoVideoView_resizeMode, SuperAspectRatioFrameLayout.RESIZE_MODE_FIT);
                rewindMs = typedArray.getInt(R.styleable.ExoVideoView_rewindIncrement, rewindMs);
                fastForwardMs = typedArray.getInt(R.styleable.ExoVideoView_fastForwardIncrement, fastForwardMs);
                controllerShowTimeoutMs = typedArray.getInt(R.styleable.ExoVideoView_showTimeout, controllerShowTimeoutMs);
                portrait = typedArray.getBoolean(R.styleable.ExoVideoView_isPortrait, true);
                textSize = typedArray.getDimension(R.styleable.ExoVideoView_topWrapperTextSize, Float.MIN_VALUE);
            } finally {
                typedArray.recycle();
            }
        }



        LayoutInflater.from(getContext()).inflate(R.layout.exo_video_view, this);

        componentListener = new ComponentListener();

        layout =  findViewById(R.id.videoFrame);
        layout.setResizeMode(resizeMode);

        frameCover =  findViewById(R.id.frameCover);

        shutterView = findViewById(R.id.shutter);

        subtitleLayout =  findViewById(R.id.subtitles);
        subtitleLayout.setUserDefaultStyle();
        subtitleLayout.setUserDefaultTextSize();


        controller =  findViewById(R.id.control);
        controller.setTopWrapperTextSize(textSize);
        controller.setPortrait(portrait);
        controller.hide();
        controller.setRewindIncrementMs(rewindMs);
        controller.setFastForwardIncrementMs(fastForwardMs);
        this.controllerShowTimeoutMs = controllerShowTimeoutMs;

        View view = useTextureView ? new TextureView(context) : new SurfaceView(context);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        view.setLayoutParams(params);
        surfaceView = view;
        layout.addView(surfaceView, 0);

        audioManager =  (AudioManager) context.getApplicationContext().getSystemService(AUDIO_SERVICE);

//        this.controllerShowTimeoutMs = controllerShowTimeoutMs;


    }
 
开发者ID:JarvanMo,项目名称:ExoPlayerVideoView,代码行数:75,代码来源:ExoVideoView.java

示例8: getPlaybackControlView

import com.google.android.exoplayer2.ui.PlaybackControlView; //导入依赖的package包/类
/****
 * 获取控制类
 *
 * @return PlaybackControlView playback control view
 */
@Nullable
public PlaybackControlView getPlaybackControlView() {
    return playerView != null ? playerView.getControllerView() : null;
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:10,代码来源:BaseView.java


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