user5894647
user5894647

Reputation: 554

Video not playing in videoview using vitamio library

I am trying to use vitamio library to play video in my app from a URL

But when the app is i its just a blank screen and there is no video playing

What is wrong?

mainactivity

public class MainActivity extends Activity 
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        String videeourl = "http://techslides.com/demos/sample-videos/small.3gp";
         // vitamo'svideoview
        VideoView mVideoView = (VideoView)findViewById(R.id.video_view);

        //Setting video path(url)
        mVideoView.setVideoPath(videeourl);

        //Setting main focus on video view
        mVideoView.requestFocus();
        mVideoView.start();

        //Initializing the video player’s media controller.
        MediaController controller = new MediaController(this);

        //Binding media controller with VideoView

        mVideoView.setMediaController(controller);

        mVideoView.start();
    }
}

Upvotes: 0

Views: 958

Answers (1)

aakash16
aakash16

Reputation: 76

In you activity make sure that the VideoView, MediaPlayer and MediaController you imported is

import io.vov.vitamio.MediaPlayer;
import io.vov.vitamio.widget.MediaController;
import io.vov.vitamio.widget.VideoView;

instead of default Android imports. Add a condition in onCreate to check vitamio Libraries:

if (!LibsChecker.checkVitamioLibs(this))
            return;

Also don't forget to include

<activity
        android:name="io.vov.vitamio.activity.InitActivity"
        android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden"
        android:launchMode="singleTop"
        android:theme="@android:style/Theme.NoTitleBar"
        android:windowSoftInputMode="stateAlwaysHidden" />

in your manifest. Finally if it doesn't works check whether the link is working or not.

Upvotes: 1

Related Questions