feat: add getCurrentPosition to component's ref (#3824)
* feat: add getCurrentPosition to component's ref --------- Co-authored-by: mostafahasani <hasanie.mostafa@alopeyk.com>
This commit is contained in:
committed by
GitHub
parent
e23e02b359
commit
c7f4d7b83b
@@ -1622,6 +1622,16 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
func getCurrentPlaybackTime(_ resolve: @escaping RCTPromiseResolveBlock, _ reject: @escaping RCTPromiseRejectBlock) {
|
||||
if let player = _playerItem {
|
||||
let currentTime = RCTVideoUtils.getCurrentTime(playerItem: player)
|
||||
resolve(currentTime)
|
||||
} else {
|
||||
reject("PLAYER_NOT_AVAILABLE", "Player is not initialized.", nil)
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for #3418 - https://github.com/TheWidlarzGroup/react-native-video/issues/3418#issuecomment-2043508862
|
||||
@objc
|
||||
func setOnClick(_: Any) {}
|
||||
|
||||
Reference in New Issue
Block a user