chore: rename setPlayerStatus
to setPlayerPauseState
This commit is contained in:
parent
01ce04c7ac
commit
421712825b
17
API.md
17
API.md
@ -1643,19 +1643,6 @@ this.player.seek(120, 50); // Seek to 2 minutes with +/- 50 milliseconds accurac
|
||||
|
||||
Platforms: iOS
|
||||
|
||||
### setPlayerStatus
|
||||
`setPlayerStatus(shouldPlay: boolean): Promise<void>`
|
||||
|
||||
Play/Pause the video.
|
||||
|
||||
Example:
|
||||
```
|
||||
this.player.setPlayerStatus(true); // Play the video
|
||||
this.player.setPlayerStatus(false); // Pause the video
|
||||
```
|
||||
|
||||
platforms: Android, iOS
|
||||
|
||||
### pause
|
||||
`pause(): Promise<void>`
|
||||
|
||||
@ -1666,8 +1653,6 @@ Example:
|
||||
this.player.pause();
|
||||
```
|
||||
|
||||
NOTE: This is the same as calling `setPlayerStatus(false)`
|
||||
|
||||
Platforms: Android, iOS
|
||||
|
||||
### play
|
||||
@ -1680,8 +1665,6 @@ Example:
|
||||
this.player.play();
|
||||
```
|
||||
|
||||
NOTE: This is the same as calling `setPlayerStatus(true)`
|
||||
|
||||
Platforms: Android, iOS
|
||||
|
||||
#### Static methods
|
||||
|
8
Video.js
8
Video.js
@ -82,15 +82,15 @@ export default class Video extends Component {
|
||||
}
|
||||
|
||||
pause = async () => {
|
||||
await this.setPlayerStatus(false);
|
||||
await this.setPlayerPauseState(false);
|
||||
};
|
||||
|
||||
play = async () => {
|
||||
await this.setPlayerStatus(true);
|
||||
await this.setPlayerPauseState(true);
|
||||
};
|
||||
|
||||
setPlayerStatus = async (shouldPlay) => {
|
||||
return await NativeModules.VideoManager.setPlayerStatus(shouldPlay, findNodeHandle(this._root));
|
||||
setPlayerPauseState = async (shouldPlay) => {
|
||||
return await NativeModules.VideoManager.setPlayerPauseState(shouldPlay, findNodeHandle(this._root));
|
||||
};
|
||||
|
||||
restoreUserInterfaceForPictureInPictureStopCompleted = (restored) => {
|
||||
|
@ -20,7 +20,7 @@ public class VideoManagerModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setPlayerStatus(Boolean shouldPlay, int reactTag) {
|
||||
public void setPlayerPauseState(Boolean shouldPlay, int reactTag) {
|
||||
UIManagerModule uiManager = getReactApplicationContext().getNativeModule(UIManagerModule.class);
|
||||
uiManager.prependUIBlock(manager -> {
|
||||
View view = manager.resolveView(reactTag);
|
||||
|
@ -728,11 +728,10 @@ class VideoPlayer extends Component {
|
||||
}
|
||||
|
||||
const {paused} = this.state;
|
||||
const {pause, play, setPlayerStatus} = this.video.current;
|
||||
const {pause, play} = this.video.current;
|
||||
const shouldPlay = paused === true || paused === undefined;
|
||||
|
||||
shouldPlay ? play() : pause();
|
||||
// OR setPlayerStatus(shouldPlay);
|
||||
|
||||
this.setState({paused: !shouldPlay});
|
||||
}}>
|
||||
|
@ -235,11 +235,10 @@ class VideoPlayer extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
const {play, pause, setPlayerStatus} = this.video.current;
|
||||
const {play, pause} = this.video.current;
|
||||
const shouldPlay = !this.state.paused;
|
||||
|
||||
shouldPlay ? play() : pause();
|
||||
// OR setPlayerStatus(shouldPlay)
|
||||
|
||||
this.setState({paused: shouldPlay});
|
||||
}}>
|
||||
|
@ -74,7 +74,7 @@ RCT_EXTERN_METHOD(setLicenseResult:(NSString *)license
|
||||
RCT_EXTERN_METHOD(setLicenseResultError(NSString *)error
|
||||
reactTag:(nonnull NSNumber *)reactTag)
|
||||
|
||||
RCT_EXTERN_METHOD(setPlayerStatus:(nonnull NSNumber *)shouldPlay
|
||||
RCT_EXTERN_METHOD(setPlayerPauseState:(nonnull NSNumber *)shouldPlay
|
||||
reactTag:(nonnull NSNumber *)reactTag)
|
||||
|
||||
RCT_EXTERN_METHOD(presentFullscreenPlayer
|
||||
|
@ -71,8 +71,8 @@ class RCTVideoManager: RCTViewManager {
|
||||
})
|
||||
}
|
||||
|
||||
@objc(setPlayerStatus:reactTag:)
|
||||
func setPlayerStatus(shouldPlay: NSNumber, reactTag: NSNumber) -> Void {
|
||||
@objc(setPlayerPauseState:reactTag:)
|
||||
func setPlayerPauseState(shouldPlay: NSNumber, reactTag: NSNumber) -> Void {
|
||||
bridge.uiManager.prependUIBlock({_ , viewRegistry in
|
||||
let view = viewRegistry?[reactTag]
|
||||
if !(view is RCTVideo) {
|
||||
|
Loading…
Reference in New Issue
Block a user