Page 1 of 1

Trouble setting currentAudioPlaybackDelay tvOS

Posted: 16 Jan 2016 17:51
by jflicks
I need to set an audio delay if on the ATV4 the user selects an alternative audio output route (other than HDMI). It's easy to find the correct delay amount using an AVAudioSession.

Code: Select all

VLCMediaPlayer *mediaplayer = [[VLCMediaPlayer alloc] init]; AVAudioSession *sess = [AVAudioSession sharedInstance]; [mediaplayer setCurrentAudioPlaybackDelay:(long) ([sess outputLatency] * 1000)];
This code doesn't work as the audio delay does not change.

I'm using a git iOS-2.7 checkout and the video I'm playing is coming from an HDHomerun TV network tuner (mpeg2), over either UDP or TCP. Thinking perhaps it's not working because of cache size, I changed the constructor to

Code: Select all

NSMutableArray *args = [[NSMutableArray alloc] init]; [args addObject:@"--udp-caching=5000"]; [args addObject:@"--tcp-caching=5000"]; VLCMediaPlayer *mediaplayer = [[VLCMediaPlayer alloc] initWithOptions:args];
with no effect in fixing the problem.

Does anyone have an idea where I may be messing up? I've tried setting the delay at construction time, after the video has begun to play, and as a test with a button press event by changing the delay by a second. All attempts result in the delay not changing at all. In this mode the audio is off by 2 seconds.

Thanks for any help!!

Re: Trouble setting currentAudioPlaybackDelay tvOS

Posted: 16 Jan 2016 18:11
by fkuehne
This should do:

Code: Select all

mediaPlayer.currentAudioPlaybackDelay = 1000000.*[[AVAudioSession sharedInstance] outputLatency];

Re: Trouble setting currentAudioPlaybackDelay tvOS

Posted: 16 Jan 2016 21:21
by jflicks
Thank you for the suggestion, as it looks like I was quite a bit off! I tried it and it all still behaves the same. It looks like the setting is just being ignored for some reason.