VLC don´t loop my video

VLC for Android and Chrome OS specific usage questions
entege
New Cone
New Cone
Posts: 1
Joined: 20 Feb 2017 08:55

VLC don´t loop my video

Postby entege » 20 Feb 2017 09:03

Hi! I have searched the forum for a answer, but have not found it. I have made a five minutes video that I want to loop, It will be on a artexhibition on saturday.
It works on vlc for pc and on my mac, but on the android mediaplayer it stops in the end of movie. I have checked the symbol for looping...

I have no knowledge of Android, but thats what the artplace want me to use.
Sorry for bad english!
/Thomas

SaundersB
Blank Cone
Blank Cone
Posts: 16
Joined: 30 Dec 2016 15:44

Re: VLC don´t loop my video

Postby SaundersB » 05 Mar 2017 00:06

I did figure this out for the Android VLC SDK. What you need to do is create an Android Surface View, and then instantiate the libVLC object to that surface view. From there, you'll need to figure out where the file is located. Once you have the file path and file name on the local device, you'll provide that to the libVLC instance. When you instantiate the libVLC object, you'll create event listeners. What you'll want to do is start the libVLC playback over from the beginning once the event "EndReached" has signaled. I also, used a boolean to only start the video playing back one time. Otherwise I was getting some events triggered more than once.

Here is what I did. Hope it helps.

Code: Select all

private void playMedia(String media){ // Verify that the application context is not null. if (mApplicationContext != null) { // Create a new libVLC object instance from the application context. try { mLibVLC = new LibVLC(mApplicationContext); } catch (IllegalStateException e) { Log.e(TAG,"Error initializing the libVLC multimedia framework!"); } Log.d(TAG, "Compiler: " + mLibVLC.compiler()); Log.d(TAG, "libVLC Version: " + mLibVLC.version()); // Create media player mMediaPlayer = new MediaPlayer(mLibVLC); mMediaPlayer.setEventListener(mPlayerListener); // Set up video output final IVLCVout vout = mMediaPlayer.getVLCVout(); vout.setVideoView(mSurfaceView); vout.addCallback(this); vout.attachViews(); // Create a new media object. mCurrentMedia = new Media(mLibVLC, media); // Enable the HW decoder. mCurrentMedia.setHWDecoderEnabled(true,true); // Set the media to the MediaPlayer. mMediaPlayer.setMedia(mCurrentMedia); // Begin playing the content. mMediaPlayer.play();

Code: Select all

private MediaPlayer.EventListener mPlayerListener = new VLCPlayerListener(this); private static class VLCPlayerListener implements MediaPlayer.EventListener { /* Master event listener for the VideoPlayer. Whenever an event occurs, we'll emit the signal that corresponds to the respective action to take. */ private WeakReference<Player> mOwner; public VLCPlayerListener(Player owner) { mOwner = new WeakReference<>(owner); } @Override public void onEvent(MediaPlayer.Event event) { Player player = mOwner.get(); switch(event.type) { case MediaPlayer.Event.EndReached: Log.d(TAG, "EndReached------------------"); if(!player.haveLoggedPlaybackResults) { player.reportPlaybackToDatabase(player.schedulePlaybackLength, player.actualPlaybackLength, "False"); player.releasePlayer(); player.createPlayer(player.TEST_FILE_PATH); player.haveLoggedPlaybackResults = true; } break;


Return to “VLC for Android and Chrome OS”

Who is online

Users browsing this forum: No registered users and 84 guests