Page 1 of 1

[VLCKit] Change subtitle settings while playing

Posted: 24 Jun 2015 12:12
by jungleMan
Hi,

I have gotten to a point, where I can play a video, including subtitles and I can adjust the subtitles as I want when I create the

Code: Select all

VLCMediaPlayer
object using

Code: Select all

-initWithOptions:
.

I am having trouble, however, changing the subtitles on-the-fly as the video is playing. I've attempted to change the options on the

Code: Select all

VLCMedia
object, but to my understanding these options only affect the parsing of the media object.

I've dug around the VLC for OS X code, and found the

Code: Select all

switchSubtitleOption:
method which uses

Code: Select all

config_PutInt
function to modify the subtitle settings. Is there a way to achieve a similar result using the VLCKit?

I don't mind doing some minor hacking (e.g. getting an internal pointer to VLC objects and using the C code) in order to achieve this, just would be glad for any help on this matter as I am not sure what would be the best way to do this...

Thanks in advance!

Re: [VLCKit] Change subtitle settings while playing

Posted: 26 Jun 2015 10:04
by spike008t
Hello,

To change on the fly the subtitle while playing, you have to set the correct value on the attribute "currentVideoSubTitleIndex" of your VLCMediaPlayer instance.
To get the values available, use "videoSubTitlesIndexes" attribute of your VLCMediaPlayer instance, that return an array with the list of the PID available.

Hope that help.

Re: [VLCKit] Change subtitle settings while playing

Posted: 26 Jun 2015 10:34
by jungleMan
Hi,

thanks for your reply. I should have perhaps been more clear - I know I can change subtitle tracks on-the-fly like this, but I need to be able to adjust e.g. subtitle size. I.e. change the subtitle size without re-creating the VLCMediaPlayer instance.

The VLC app itself does this via function config_PutInt, which I'm able to get via dlsym, but I don't know what to pass as the first parameter of the function. I've tried virtually everything - [VLCLibrary sharedInstance] (which returns the handle to the vlc object), [player libVLCMediaPlayer] (which returns a handle to the libVLC object) and [[player media] libVLCMediaDescriptor] (which returns a handle to the media object). Note that all aforementioned methods are private methods I've found by examining the VLCKit source code, but I don't really mind relying on those.