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