Fixed issue for IOS and android

This commit is contained in:
Alex Kim
2024-12-07 05:41:46 +11:00
parent 24320541c7
commit 38445c6959
3 changed files with 51 additions and 9 deletions

View File

@@ -5,7 +5,9 @@ public class VlcPlayerModule: Module {
Name("VlcPlayer")
View(VlcPlayerView.self) {
Prop("source") { (view: VlcPlayerView, source: [String: Any]) in
view.setSource(source)
if !view.hasSource {
view.setSource(source)
}
}
Prop("paused") { (view: VlcPlayerView, paused: Bool) in

View File

@@ -16,6 +16,7 @@ class VlcPlayerView: ExpoView {
private var externalTrack: [String: String]?
private var progressTimer: DispatchSourceTimer?
private var isStopping: Bool = false // Define isStopping here
var hasSource = false
// MARK: - Initialization
@@ -157,6 +158,7 @@ class VlcPlayerView: ExpoView {
self.setSubtitleTrack(subtitleTrackIndex)
self.mediaPlayer?.media = media
hasSource = true
if autoplay {
print("Playing...")
@@ -280,15 +282,11 @@ class VlcPlayerView: ExpoView {
// MARK: - Private Methods
@objc private func applicationWillResignActive() {
if !isPaused {
pause()
}
}
@objc private func applicationDidBecomeActive() {
if !isPaused {
play()
}
}
private func performStop(completion: (() -> Void)? = nil) {