[VLCKit] Change subtitle settings while playing

This forum is about all development around libVLC.
jungleMan
New Cone
New Cone
Posts: 6
Joined: 24 Jun 2015 12:02

[VLCKit] Change subtitle settings while playing

Postby jungleMan » 24 Jun 2015 12:12

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!

spike008t
New Cone
New Cone
Posts: 2
Joined: 03 Feb 2015 13:16

Re: [VLCKit] Change subtitle settings while playing

Postby spike008t » 26 Jun 2015 10:04

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.

jungleMan
New Cone
New Cone
Posts: 6
Joined: 24 Jun 2015 12:02

Re: [VLCKit] Change subtitle settings while playing

Postby jungleMan » 26 Jun 2015 10:34

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.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 29 guests