fix(ios): remove pip check for other platforms (#3991)
* fix(ios): remove pip check for other platforms * Update ios/Video/RCTVideo.swift
This commit is contained in:
parent
111a5d2163
commit
40a72825e6
@ -171,6 +171,14 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
return _pictureInPictureEnabled
|
||||
}
|
||||
|
||||
func isPipActive() -> Bool {
|
||||
#if os(iOS)
|
||||
return _pip?._pipController?.isPictureInPictureActive == true
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
func initPictureinPicture() {
|
||||
#if os(iOS)
|
||||
_pip = RCTPictureInPicture({ [weak self] in
|
||||
@ -298,7 +306,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
@objc
|
||||
func applicationDidEnterBackground(notification _: NSNotification!) {
|
||||
let isExternalPlaybackActive = _player?.isExternalPlaybackActive ?? false
|
||||
if !_playInBackground || isExternalPlaybackActive || _pip?._pipController?.isPictureInPictureActive == true { return }
|
||||
if !_playInBackground || isExternalPlaybackActive || isPipActive() { return }
|
||||
// Needed to play sound in background. See https://developer.apple.com/library/ios/qa/qa1668/_index.html
|
||||
_playerLayer?.player = nil
|
||||
_playerViewController?.player = nil
|
||||
|
Loading…
Reference in New Issue
Block a user