Page 1 of 1

mute playback before started

Posted: 09 Oct 2016 14:30
by ssbmaccom
Hi,

I am using TVVLCKit.framework, most often build locally due to some issues.

Users reported to me, that esp. with Audio-Passthrough they have distortion noise when switching from one stream to the other. It just takes a moment until the decoder gets in sync and playback is back to normal. But in a Home-Cinema environment this short distortion can ruin the equipment or the ears.

To get around that I wanted to mute the playback before playback is started and then with delay unmute again.
So I use [_mediaplayer.audio setMuted:YES]; after initializing the the media player.
Then with a delay of 0.2 seconds I use [_mediaplayer play]; to start playback on a background thread.
Finally I wanted to use [_mediaplayer.audio setMuted:NO]; to unmute the stream.

Well this does not work. Looks like muting only works, when playback has already started - which does not solve the issue reported by users of my App.

Any suggestions?

Re: mute playback before started

Posted: 09 Oct 2016 21:16
by MidnightCoder
Look into passing the audio-track-to-play as an argument into the media/player. Similar to passing the audio-delay amount. I'm not sure how to do it exactly on VLCKit but with LibVLC in general, that is how you would do it before the player started playing.

Do post your solution if you do get it to work. Thanks!

Re: mute playback before started

Posted: 10 Oct 2016 18:05
by ssbmaccom
Well... I do not want to reconfigure the audio track, I just want it muted.
And before playing the current audio channel might not even be available to disable and re-enable the right track.

Re: mute playback before started

Posted: 10 Oct 2016 19:58
by MidnightCoder
What I meant is pass in track -1 as option into the media/player. This effectively mute the audio at start up and you can change the track number afterward.

Re: mute playback before started

Posted: 11 Oct 2016 00:05
by ssbmaccom
yes... just bad it needs to be done with this workaround.
Set -1 audio stream, then mute, then set desired audio stream, then unmute.
But how can I get the preferred audio stream, before the video is playing? currentAudio might not be set then.

But I will try.

Re: mute playback before started

Posted: 11 Oct 2016 04:25
by MidnightCoder
-1 means mute already so don't need to mute and unmutes. Pseudo code:

1. pass -1 as audio track into media/player
2. Set media to player
3. Play()
4. Delay (x millisecond)
5. player.currentAudioTrackIndex = 0

Since zero is the default audio track (as if you skipped step 1-2 above), I think the end result is exactly what you wanted.

Re: mute playback before started

Posted: 11 Oct 2016 23:04
by ssbmaccom
I will check on this esp. if the distortions do not happen, when changing the audio channel. I check with one of my testers. Otherwise I have to add mute and unmute as i mentioned...