Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Subtitle Support #62

Open
jibon57 opened this issue Mar 21, 2017 · 7 comments
Open

Feature Request: Subtitle Support #62

jibon57 opened this issue Mar 21, 2017 · 7 comments

Comments

@jibon57
Copy link

jibon57 commented Mar 21, 2017

Hello,

Thanks for the plugin. Can I use subtitle?

Thanks

@bradmartin
Copy link
Collaborator

bradmartin commented Mar 21, 2017

You can, it hasn't been abstracted into the plugin to be easily used though. So you'd need to make the native calls with the video player ios and android instances at this time. I'll change this to a Feature Request issue. Thanks 👍

Android method: https://developer.android.com/reference/android/media/MediaPlayer.html#addTimedTextSource(java.lang.String, java.lang.String) I'm not sure about the iOS method (not my specialty).

@bradmartin bradmartin changed the title Subtitle Support? Feature Request: Subtitle Support Mar 21, 2017
@jibon57
Copy link
Author

jibon57 commented May 16, 2017

Hi, any chance to get this feature?

@bnussey
Copy link
Contributor

bnussey commented May 16, 2017

I would advise submitting a PR. For me, its not a core requirement so I don't think this will happen any time soon.

@jibon57
Copy link
Author

jibon57 commented May 16, 2017

Thanks for reply. Will you please give me little bit more hints? I am coming from web development knowledge. Don't have good knowledge on Android or IOS core. I can try by myself if you give me a good start :)

@bradmartin
Copy link
Collaborator

bradmartin commented May 16, 2017

@jibon57
If you want the simplest way to start with this would be to add a public method on the VideoPlayer class.
Lets look at this line https://github.com/bradmartin/nativescript-videoplayer/blob/master/videoplayer.android.ts#L403 for the public isPlaying method on the android source.

So you could add a public method called setSubtitleTrack() or something like that after the isPlaying method since that is inside the VideoPlayer class. If you look at the isPlaying class it's calling this.mediaPlayer.isPlaying(). Where this.mediaPlayer (you can go up to the creation of the view instance and see it is equal to a new MediaPlayer https://github.com/bradmartin/nativescript-videoplayer/blob/master/videoplayer.android.ts#L325) is calling isPlaying(). At this point we are calling the native isPlaying method from the android MediaPlayer - documented here. So inside your public method to set the subtitle you can call this.mediaPlayer.addTimedTextSource(....) in the android docs here https://developer.android.com/reference/android/media/MediaPlayer.html#addTimedTextSource. That overload of the native method is expecting the android context, a url, and a mimetype as string - there are 3 other overloads for that method, which you can find in the Android docs right above the previous link.

@jibon57
Copy link
Author

jibon57 commented May 17, 2017

@bradmartin, Thanks for the hints. I found one project related with subtitle for android here: https://github.com/Sriharia/Subtitle-Converter
I am also checking it, if I can understand :)

@jibon57
Copy link
Author

jibon57 commented Jul 17, 2017

@bradmartin , My team has implemented this feature here: https://github.com/NathanaelA/nativescript-exoplayer
You can have a look this 2 pulls:
NathanaelA/nativescript-exoplayer#9
NathanaelA/nativescript-exoplayer#10
Hope it will easy for you to implement in your plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants