mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-21 08:41:57 +00:00
Merge pull request #370 from Eazvy/main
fix escape key crashing on macOS
This commit is contained in:
commit
0722923a78
1 changed files with 22 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ class KSPlayerView: UIView {
|
||||||
@objc var onEnd: RCTDirectEventBlock?
|
@objc var onEnd: RCTDirectEventBlock?
|
||||||
@objc var onError: RCTDirectEventBlock?
|
@objc var onError: RCTDirectEventBlock?
|
||||||
@objc var onBufferingProgress: RCTDirectEventBlock?
|
@objc var onBufferingProgress: RCTDirectEventBlock?
|
||||||
|
@objc var onExitFullscreen: RCTDirectEventBlock?
|
||||||
|
|
||||||
// Property setters that React Native will call
|
// Property setters that React Native will call
|
||||||
@objc var source: NSDictionary? {
|
@objc var source: NSDictionary? {
|
||||||
|
|
@ -313,6 +314,22 @@ class KSPlayerView: UIView {
|
||||||
} else {
|
} else {
|
||||||
playerView.play()
|
playerView.play()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override var keyCommands: [UIKeyCommand]? {
|
||||||
|
return [
|
||||||
|
UIKeyCommand(
|
||||||
|
input: UIKeyCommand.inputEscape,
|
||||||
|
modifierFlags: [],
|
||||||
|
action: #selector(handleEscapeKey),
|
||||||
|
discoverabilityTitle: "Exit Fullscreen"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func handleEscapeKey() {
|
||||||
|
print("KSPlayerView: ESC pressed")
|
||||||
|
sendEvent("onExitFullscreen", [:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func setVolume(_ volume: Float) {
|
func setVolume(_ volume: Float) {
|
||||||
|
|
@ -979,3 +996,8 @@ extension KSPlayerView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension IOSVideoPlayerView {
|
||||||
|
@objc func handleEscapeKey() {
|
||||||
|
self.next?.perform(#selector(handleEscapeKey))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue