forked from Ninjalama/streamyfin_mirror
Co-authored-by: lostb1t <coding-mosses0z@icloud.com> Co-authored-by: Fredrik Burmester <fredrik.burmester@gmail.com> Co-authored-by: Gauvain <68083474+Gauvino@users.noreply.github.com> Co-authored-by: Gauvino <uruknarb20@gmail.com> Co-authored-by: storm1er <le.storm1er@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Chris <182387676+whoopsi-daisy@users.noreply.github.com> Co-authored-by: arch-fan <55891793+arch-fan@users.noreply.github.com> Co-authored-by: Alex Kim <alexkim@Alexs-MacBook-Pro.local>
71 lines
2.1 KiB
Swift
71 lines
2.1 KiB
Swift
import ExpoModulesCore
|
|
|
|
public class VlcPlayerModule: Module {
|
|
public func definition() -> ModuleDefinition {
|
|
Name("VlcPlayer")
|
|
View(VlcPlayerView.self) {
|
|
Prop("source") { (view: VlcPlayerView, source: [String: Any]) in
|
|
view.setSource(source)
|
|
}
|
|
|
|
Prop("paused") { (view: VlcPlayerView, paused: Bool) in
|
|
if paused {
|
|
view.pause()
|
|
} else {
|
|
view.play()
|
|
}
|
|
}
|
|
|
|
Events(
|
|
"onPlaybackStateChanged",
|
|
"onVideoStateChange",
|
|
"onVideoLoadStart",
|
|
"onVideoLoadEnd",
|
|
"onVideoProgress",
|
|
"onVideoError",
|
|
"onPipStarted"
|
|
)
|
|
|
|
AsyncFunction("startPictureInPicture") { (view: VlcPlayerView) in
|
|
view.startPictureInPicture()
|
|
}
|
|
|
|
AsyncFunction("play") { (view: VlcPlayerView) in
|
|
view.play()
|
|
}
|
|
|
|
AsyncFunction("pause") { (view: VlcPlayerView) in
|
|
view.pause()
|
|
}
|
|
|
|
AsyncFunction("stop") { (view: VlcPlayerView) in
|
|
view.stop()
|
|
}
|
|
|
|
AsyncFunction("seekTo") { (view: VlcPlayerView, time: Int32) in
|
|
view.seekTo(time)
|
|
}
|
|
|
|
AsyncFunction("setAudioTrack") { (view: VlcPlayerView, trackIndex: Int) in
|
|
view.setAudioTrack(trackIndex)
|
|
}
|
|
|
|
AsyncFunction("getAudioTracks") { (view: VlcPlayerView) -> [[String: Any]]? in
|
|
return view.getAudioTracks()
|
|
}
|
|
|
|
AsyncFunction("setSubtitleURL") { (view: VlcPlayerView, url: String, name: String) in
|
|
view.setSubtitleURL(url, name: name)
|
|
}
|
|
|
|
AsyncFunction("setSubtitleTrack") { (view: VlcPlayerView, trackIndex: Int) in
|
|
view.setSubtitleTrack(trackIndex)
|
|
}
|
|
|
|
AsyncFunction("getSubtitleTracks") { (view: VlcPlayerView) -> [[String: Any]]? in
|
|
return view.getSubtitleTracks()
|
|
}
|
|
}
|
|
}
|
|
}
|