0

I use Vitamio library to make a RTSP streaming app for Android phone. Now I need to create a play/pause button for the player. Normally I can just use mVideoView.setMediaController(new MediaController(getActivity())) to create it, but it will mess up my layout, so I opted to create a custom button instead. I created a button with help from github source :

<ImageButton
        android:id="@+id/mediacontroller_play_pause"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        android:background="@drawable/mediacontroller_button"
        android:contentDescription="@string/mediacontroller_play_pause"
        android:src="@drawable/mediacontroller_pause" />

now, the hard part is write code to make this button functional. There is code for that function in Vitamio's MediaControlller.java but I can't make it work at all. Help is much appreciated, thanks for reading. Here is a link to the java file for reference.

ProudNoob
  • 77
  • 2
  • 13

2 Answers2

1

Hey mate after march 2016 google playstore has has applied restrictions on vitamio library.I have experienced this problem they will instantly reject your application because of malicious behaviour of vitamio lib.I suggest you to us EXOPLAYER Which is provided by google and it is pretty much faster than vitamio(personal experience) here's the link here's the link.

Ezio
  • 23
  • 5
  • Damn, so that's why my app got rejected by Play Store immediately. Thank you – ProudNoob Aug 31 '16 at 02:15
  • 1
    Yes mate they will send you a email that you are using a older version of vitamio blah blah blah .......use above versions 5.0.0 blah blah.... – Ezio Aug 31 '16 at 06:52
  • 1
    Try exoplayer fast compared to vitamio for streaming in my case. – Ezio Aug 31 '16 at 06:54
  • Can it play RTSP stream though. I tried exoplayer, but they are so confusing to follow as a newbie. – ProudNoob Aug 31 '16 at 07:07
1

first add dependency compile 'com.devbrackets.android:exomedia:3.0.2' in gradle

add this to layout.xml

<com.devbrackets.android.exomedia.ui.widget.EMVideoView
        android:id="@+id/video_view"
        android:layout_width="match_parent"
        android:layout_height="350dp"
        EMVideoView:useDefaultControls="true"/>

add this to your activity

 EMVideoView emVideoView = (EMVideoView)findViewById(R.id.video_view);
        emVideoView.setVideoURI(Uri.parse(//your link or first add String variable path which contains your url and pass it here));
        emVideoView.setOnPreparedListener(this);
        emVideoView.start();

you can achieve basic player using this code and don't forget to check that you have included INTERNET permission in manifest.

Ezio
  • 23
  • 5
  • Exoplayer doesn't work for RTSP, thanks for your help tho. – ProudNoob Sep 01 '16 at 02:06
  • 1
    Have a look at this http://stackoverflow.com/questions/11274906/play-rtsp-streaming-in-an-android-application this might help you. – Ezio Sep 01 '16 at 19:10