mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-05-27 01:06:42 +01:00
working
This commit is contained in:
@@ -1,22 +1,88 @@
|
||||
import ExpoModulesCore
|
||||
|
||||
public class VlcPlayerModule: Module {
|
||||
// Each module class must implement the definition function. The definition consists of components
|
||||
// that describes the module's functionality and behavior.
|
||||
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
||||
public func definition() -> ModuleDefinition {
|
||||
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
|
||||
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
|
||||
// The module will be accessible from `requireNativeModule('VlcPlayer')` in JavaScript.
|
||||
Name("VlcPlayer")
|
||||
View(VlcPlayerView.self) {
|
||||
Prop("source") { (view: VlcPlayerView, source: String) in
|
||||
view.setSource(source)
|
||||
}
|
||||
}
|
||||
public func definition() -> ModuleDefinition {
|
||||
Name("VlcPlayer")
|
||||
View(VlcPlayerView.self) {
|
||||
Prop("source") { (view: VlcPlayerView, source: [String: Any]) in
|
||||
view.setSource(source)
|
||||
}
|
||||
|
||||
Function("hello") {
|
||||
return "hello from native ios"
|
||||
Prop("progressUpdateInterval") { (view: VlcPlayerView, interval: Double) in
|
||||
view.setProgressUpdateInterval(interval)
|
||||
}
|
||||
|
||||
Prop("paused") { (view: VlcPlayerView, paused: Bool) in
|
||||
if paused {
|
||||
view.pause()
|
||||
} else {
|
||||
view.play()
|
||||
}
|
||||
}
|
||||
|
||||
Prop("muted") { (view: VlcPlayerView, muted: Bool) in
|
||||
view.setMuted(muted)
|
||||
}
|
||||
|
||||
Prop("volume") { (view: VlcPlayerView, volume: Int) in
|
||||
view.setVolume(volume)
|
||||
}
|
||||
|
||||
Prop("videoAspectRatio") { (view: VlcPlayerView, ratio: String) in
|
||||
view.setVideoAspectRatio(ratio)
|
||||
}
|
||||
|
||||
Events(
|
||||
"onProgress",
|
||||
"onPlaybackStateChanged",
|
||||
"onVideoLoadStart",
|
||||
"onVideoStateChange",
|
||||
"onVideoProgress"
|
||||
)
|
||||
|
||||
AsyncFunction("play") { (view: VlcPlayerView) in
|
||||
view.play()
|
||||
}
|
||||
|
||||
AsyncFunction("pause") { (view: VlcPlayerView) in
|
||||
view.pause()
|
||||
}
|
||||
|
||||
AsyncFunction("seekTo") { (view: VlcPlayerView, time: Double) in
|
||||
view.seekTo(time)
|
||||
}
|
||||
|
||||
AsyncFunction("jumpBackward") { (view: VlcPlayerView, interval: Int) in
|
||||
view.jumpBackward(interval)
|
||||
}
|
||||
|
||||
AsyncFunction("jumpForward") { (view: VlcPlayerView, interval: Int) in
|
||||
view.jumpForward(interval)
|
||||
}
|
||||
|
||||
AsyncFunction("setAudioTrack") { (view: VlcPlayerView, trackIndex: Int) in
|
||||
view.setAudioTrack(trackIndex)
|
||||
}
|
||||
|
||||
AsyncFunction("getAudioTracks") { (view: VlcPlayerView) -> [[String: Any]]? in
|
||||
return view.getAudioTracks()
|
||||
}
|
||||
|
||||
AsyncFunction("setSubtitleTrack") { (view: VlcPlayerView, trackIndex: Int) in
|
||||
view.setSubtitleTrack(trackIndex)
|
||||
}
|
||||
|
||||
AsyncFunction("getSubtitleTracks") { (view: VlcPlayerView) -> [[String: Any]]? in
|
||||
return view.getSubtitleTracks()
|
||||
}
|
||||
|
||||
AsyncFunction("setVideoCropGeometry") { (view: VlcPlayerView, geometry: String?) in
|
||||
view.setVideoCropGeometry(geometry)
|
||||
}
|
||||
|
||||
AsyncFunction("getVideoCropGeometry") { (view: VlcPlayerView) -> String? in
|
||||
return view.getVideoCropGeometry()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user