4

I want create MediaPlayer with custom design, but how to do it I can't find. I make streaming media player:

...
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();
    }
...

Please, help me. I found a lot of topics in stackoverflow, but the problem was not solved! Thanks in advance!

ArtKorchagin
  • 4,801
  • 13
  • 42
  • 58

1 Answers1

-1

Alternatively you can use Exoplayer to play your videos

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'

}

use PlayerView instead of video view and give path to custom_playback_control in app:controller_layout_id attr

  <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

Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154