4

我想用自定义设计创建 MediaPlayer,但我找不到怎么做。我制作流媒体播放器:

...
mVideoView = (VideoView) findViewById(R.id.vedio_view);
mBtnHttp = (Button) findViewById(R.id.btn_http);
mBtnHttp.setOnClickListener(this);
mMediaController = new MediaController(this);
...
public void onClick(View v) {
    mVideoView.setVideoURI(Uri.parse(uri));
    mVideoView.start();
    mVideoView.requestFocus();
    mMediaController.show();
    }
...

请帮我。我在stackoverflow中找到了很多主题,但问题没有解决!提前致谢!

4

1 回答 1

-1

或者,您可以使用 Exoplayer 播放您的视频

dependencies {
   [...]

implementation 'com.google.android.exoplayer:exoplayer-core:2.7.3'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.7.3'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.7.3'

}

使用 PlayerView 而不是视频视图,并在 app:controller_layout_id attr 中给出 custom_playback_control 的路径

  <com.google.android.exoplayer2.ui.PlayerView  
   android:id="@+id/video_view"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   app:controller_layout_id="@layout/custom_playback_control"/>

https://codelabs.developers.google.com/codelabs/exoplayer-intro/#6

于 2019-02-27T07:37:43.163 回答