chore: invert setPlayerPauseState
logic
This commit is contained in:
parent
106257aa80
commit
f9743fdbd6
12
Video.js
12
Video.js
@ -82,15 +82,15 @@ export default class Video extends Component {
|
||||
}
|
||||
|
||||
pause = async () => {
|
||||
await this.setPlayerPauseState(false);
|
||||
};
|
||||
|
||||
play = async () => {
|
||||
await this.setPlayerPauseState(true);
|
||||
};
|
||||
|
||||
setPlayerPauseState = async (shouldPlay) => {
|
||||
return await NativeModules.VideoManager.setPlayerPauseState(shouldPlay, findNodeHandle(this._root));
|
||||
play = async () => {
|
||||
await this.setPlayerPauseState(false);
|
||||
};
|
||||
|
||||
setPlayerPauseState = async (paused) => {
|
||||
return await NativeModules.VideoManager.setPlayerPauseState(paused, findNodeHandle(this._root));
|
||||
};
|
||||
|
||||
restoreUserInterfaceForPictureInPictureStopCompleted = (restored) => {
|
||||
|
@ -20,14 +20,14 @@ public class VideoManagerModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setPlayerPauseState(Boolean shouldPlay, int reactTag) {
|
||||
public void setPlayerPauseState(Boolean paused, int reactTag) {
|
||||
UIManagerModule uiManager = getReactApplicationContext().getNativeModule(UIManagerModule.class);
|
||||
uiManager.prependUIBlock(manager -> {
|
||||
View view = manager.resolveView(reactTag);
|
||||
|
||||
if (view instanceof ReactExoplayerView) {
|
||||
ReactExoplayerView videoView = (ReactExoplayerView) view;
|
||||
videoView.setPausedModifier(!shouldPlay);
|
||||
videoView.setPausedModifier(paused);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ RCT_EXTERN_METHOD(setLicenseResult:(NSString *)license
|
||||
RCT_EXTERN_METHOD(setLicenseResultError(NSString *)error
|
||||
reactTag:(nonnull NSNumber *)reactTag)
|
||||
|
||||
RCT_EXTERN_METHOD(setPlayerPauseState:(nonnull NSNumber *)shouldPlay
|
||||
RCT_EXTERN_METHOD(setPlayerPauseState:(nonnull NSNumber *)paused
|
||||
reactTag:(nonnull NSNumber *)reactTag)
|
||||
|
||||
RCT_EXTERN_METHOD(presentFullscreenPlayer
|
||||
|
@ -72,14 +72,14 @@ class RCTVideoManager: RCTViewManager {
|
||||
}
|
||||
|
||||
@objc(setPlayerPauseState:reactTag:)
|
||||
func setPlayerPauseState(shouldPlay: NSNumber, reactTag: NSNumber) -> Void {
|
||||
func setPlayerPauseState(paused: NSNumber, reactTag: NSNumber) -> Void {
|
||||
bridge.uiManager.prependUIBlock({_ , viewRegistry in
|
||||
let view = viewRegistry?[reactTag]
|
||||
if !(view is RCTVideo) {
|
||||
RCTLogError("Invalid view returned from registry, expecting RCTVideo, got: %@", String(describing: view))
|
||||
} else if let view = view as? RCTVideo {
|
||||
let shouldPlay = shouldPlay.boolValue
|
||||
view.setPaused(!shouldPlay)
|
||||
let paused = paused.boolValue
|
||||
view.setPaused(paused)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user