mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-04-21 16:24:41 +01:00
fix: bug in playback speed
This commit is contained in:
@@ -90,6 +90,10 @@ class VlcPlayerModule : Module() {
|
|||||||
AsyncFunction("setVideoScaleFactor") { view: VlcPlayerView, scaleFactor: Float ->
|
AsyncFunction("setVideoScaleFactor") { view: VlcPlayerView, scaleFactor: Float ->
|
||||||
view.setVideoScaleFactor(scaleFactor)
|
view.setVideoScaleFactor(scaleFactor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AsyncFunction("setRate") { view: VlcPlayerView, rate: Float ->
|
||||||
|
view.setRate(rate)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -343,6 +343,11 @@ class VlcPlayerView(context: Context, appContext: AppContext) : ExpoView(context
|
|||||||
mediaPlayer?.scale = scaleFactor
|
mediaPlayer?.scale = scaleFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setRate(rate: Float) {
|
||||||
|
log.debug("Setting playback rate: $rate")
|
||||||
|
mediaPlayer?.rate = rate
|
||||||
|
}
|
||||||
|
|
||||||
private fun setInitialExternalSubtitles() {
|
private fun setInitialExternalSubtitles() {
|
||||||
externalSubtitles?.let { subtitles ->
|
externalSubtitles?.let { subtitles ->
|
||||||
for (subtitle in subtitles) {
|
for (subtitle in subtitles) {
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ public class VlcPlayerModule: Module {
|
|||||||
AsyncFunction("getSubtitleTracks") { (view: VlcPlayerView) -> [[String: Any]]? in
|
AsyncFunction("getSubtitleTracks") { (view: VlcPlayerView) -> [[String: Any]]? in
|
||||||
return view.getSubtitleTracks()
|
return view.getSubtitleTracks()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AsyncFunction("setRate") { (view: VlcPlayerView, rate: Float) in
|
||||||
|
view.setRate(rate)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,6 +433,13 @@ class VlcPlayerView: ExpoView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func setRate(_ rate: Float) {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.mediaPlayer?.rate = rate
|
||||||
|
print("Set playback rate: \(rate)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc func setNowPlayingMetadata(_ metadata: [String: String]) {
|
@objc func setNowPlayingMetadata(_ metadata: [String: String]) {
|
||||||
// Cancel any existing artwork download to prevent race conditions
|
// Cancel any existing artwork download to prevent race conditions
|
||||||
artworkDownloadTask?.cancel()
|
artworkDownloadTask?.cancel()
|
||||||
|
|||||||
Reference in New Issue
Block a user