MediaPlayer custom class in android

I just finished a project where I use webwiew to play a video. Now they will ask me to replace part of webview with a user player. The player must be able to handle HLS.

If I use VideoView and MediaController, I can play live. But unfortunately, MediaController has its own controls. I want my own controls and where I am stuck.

So far I have tried:

  • To write the MediaController class again and try to change the location. It did not work because I could not clear all errors due to dependencies.
  • I tried using vidtry code (http://github.com/commonsguy/vidtry) for the link, but not luck.
  • I tried to create a class that extends MediaController, but it didnt work either.

I was in almost every thread on Stackoverflow regarding a custom media player, but couldn't find the information to get me started.
Is it possible to create a custom media player class without using the NDK?
If someone knows how to create a custom media player class, please help me.
Thanks in advance!

+7
source share
1 answer

You can use VideoView yourself and call its methods to control playback, such as start () , stopPlayback () , pause () , resume () , seekTo () , etc. (See the class link here: http://developer.android.com/reference/android/widget/VideoView.html )

Just create on-screen controls, but you want (buttons / images) and attach the code for the playback control code to your events.

You will also want to disable the built-in VideoView controls by removing the touchable property in layout.xml ...

<VideoView android:id="@+id/myVideoView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:clickable="false" > 
+1
source

All Articles