Comments (7)
@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.
from nativescript-videoplayer.
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).
from nativescript-videoplayer.
Hi, any chance to get this feature?
from nativescript-videoplayer.
I would advise submitting a PR. For me, its not a core requirement so I don't think this will happen any time soon.
from nativescript-videoplayer.
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 :)
from nativescript-videoplayer.
@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 :)
from nativescript-videoplayer.
@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.
from nativescript-videoplayer.
Related Issues (20)
- Uncaught Error: Cannot find module 'nativescript-angular/element-registry HOT 3
- Migrated app to v7 and videoplayer 5.0.1, now getting error on compile HOT 4
- Question: Playing Video on Viewport and More HOT 5
- Question: How to detect video is playing or paused HOT 2
- The plugin is taking over the audio focus even on muted videos HOT 2
- Error playback on iOS 13
- getDuration on live stream returns NaN
- Angular Nativescript 6.3.3 | Video is not displaying HOT 2
- Keep playing while the app is in background
- Not compatible with NativeScript 8.1 HOT 5
- Unable to play remote videos that are streamed from a DB (from urls) HOT 3
- ios crash with migrate to ns8. Only in --release HOT 1
- Ability to show subtitles?
- Does this player work for m3u8/hls streams?
- couldnt find registerElement in nativescript-angular/element-registry HOT 1
- unable to play video
- Demo Not working
- Video player options not visible on iOS 16 HOT 1
- Repocitor
- Re
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-videoplayer.