Multiple instances LibVLC Android

This forum is about all development around libVLC.
KrisMar
Blank Cone
Blank Cone
Posts: 12
Joined: 15 May 2017 23:26

Multiple instances LibVLC Android

Postby KrisMar » 27 May 2017 12:45

Hello, I have tried to initiate several instances of VLC on android but seems to fail. And I have seen that it can play two tracks/streams at once in windows (though i havent tried) and I know there can be sort of unlimited number of instances on windows.. So I was wondering if there is anything that must be enabled in the code for it to be able to play several instances or if it is not able to run several instances without being modified in source?

KrisMar
Blank Cone
Blank Cone
Posts: 12
Joined: 15 May 2017 23:26

Re: Multiple instances LibVLC Android

Postby KrisMar » 27 May 2017 14:05

This is the code I use, and when the second player is initiated both tracks have a call to internal pause on androids native track or something.

Code: Select all

ArrayList<String> options = new ArrayList<>(); options.add("--file-caching=1500"); LibVLC mLibVLC = new LibVLC(getActivity().getApplicationContext(),options); MediaPlayer mMediaPlayer; mMediaPlayer = new MediaPlayer(mLibVLC); Media media = new Media(mLibVLC, Uri.parse("http://")); media.setHWDecoderEnabled(true, false); media.addOption(":network-caching=1000"); mMediaPlayer.setMedia(media); mMediaPlayer.play(); MediaPlayer mMediaPlayer2; mMediaPlayer2 = new MediaPlayer(mLibVLC); Media media2 = new Media(mLibVLC, Uri.parse("http://")); media2.setHWDecoderEnabled(true, false); media2.addOption(":network-caching=1000"); mMediaPlayer2.setMedia(media2); mMediaPlayer2.play();
I have tried to have each as a seperate instance in a seperate thread and as above, and it won't work. remove the second or the first and it works just fine. (just add a http stream/mp3 url and it should be "working" and give the results I have)

This is the log data when the track stops,

D/AudioTrackCenter: setTrackActive, trackId: 0x9d16e000, active: 1
D/AudioTrack: AudioTrackThread::pauseInternal: ns = 9223372036854775807

KrisMar
Blank Cone
Blank Cone
Posts: 12
Joined: 15 May 2017 23:26

Re: Multiple instances LibVLC Android

Postby KrisMar » 28 May 2017 10:27

Sorry. I thought I had searched everywhere for an answer. Found a bug/feature request and it seems that this issue should have been fixed.
I saw Milestone said 3.0.0 is that the same as it's fixed in version 3+?

KrisMar
Blank Cone
Blank Cone
Posts: 12
Joined: 15 May 2017 23:26

Re: Multiple instances LibVLC Android

Postby KrisMar » 28 May 2017 14:22

Im building libvlc from git url provided in the androidcompile instructions now, but I suddenly thought of somethng, will that provide the latest build you have,
as in with the fix of multiple, or will I need to find the special git or zip for the 3.0.0 lib?

KrisMar
Blank Cone
Blank Cone
Posts: 12
Joined: 15 May 2017 23:26

Re: Multiple instances LibVLC Android

Postby KrisMar » 28 May 2017 20:51

And the answer was yes. it is the fixed version. :) nice work

KrisMar
Blank Cone
Blank Cone
Posts: 12
Joined: 15 May 2017 23:26

Re: Multiple instances LibVLC Android

Postby KrisMar » 01 Jun 2017 12:58

I am still often getting this pauseInternal problem
D/AudioTrackCenter: setTrackActive, trackId: 0x9fbd5080, active: 1
D/AudioTrack: AudioTrackThread::pauseInternal: ns = 9223372036854775807

This error/problem is without starting several threads too. I cant seem to figure out what is wrong. Tried checking isPlaying and starting if not, but no difference in results..
Have also tried restarting streams after player is initiated but no difference there either..

KrisMar
Blank Cone
Blank Cone
Posts: 12
Joined: 15 May 2017 23:26

Re: Multiple instances LibVLC Android

Postby KrisMar » 03 Jun 2017 13:19

Ok.. So it seems this issue is a network or android issue. Instaces have to be started one after the other sender, receiver, sender, receiver.. if I do sender sender, receiver receiver, and it fails. same with the other way..
anyone knows why? I would understand it if this was a sip or telephone stream, but just a rtp audio/video stream should be no problem?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 7 guests