VEX-6540: Disable recording when playing local videos (#18)
This PR adds core actions to enable or disable screenshots Jira: VEX-6540 https://jira.tenkasu.net/browse/VEX-6540 velocity PR: crunchyroll/velocity#2248 New core actions were added to control the player surface and mark it as secure. Sending the prop to react-native-video will recreate the surface of the player changing it to a SurfaceView and enabling security Reviews Major reviewer (domain expert): @nickfujita Minor reviewer: @armadilio3
This commit is contained in:
commit
e6dd52a245
13
README.md
13
README.md
@ -316,6 +316,7 @@ var styles = StyleSheet.create({
|
||||
* [textTracks](#texttracks)
|
||||
* [trackId](#trackId)
|
||||
* [useTextureView](#usetextureview)
|
||||
* [useSecureView](#useSecureView)
|
||||
* [volume](#volume)
|
||||
* [localSourceEncryptionKeyScheme](#localSourceEncryptionKeyScheme)
|
||||
|
||||
@ -911,6 +912,18 @@ useTextureView can only be set at same time you're setting the source.
|
||||
|
||||
Platforms: Android ExoPlayer
|
||||
|
||||
#### useSecureView
|
||||
Force the output to a SurfaceView and enables the secure surface.
|
||||
|
||||
This will override useTextureView flag.
|
||||
|
||||
SurfaceView is is the only one that can be labeled as secure.
|
||||
|
||||
* **true** - Use security
|
||||
* **false (default)** - Do not use security
|
||||
|
||||
Platforms: Android ExoPlayer
|
||||
|
||||
#### volume
|
||||
Adjust the volume.
|
||||
* **1.0 (default)** - Play at full volume
|
||||
|
1
Video.js
1
Video.js
@ -488,6 +488,7 @@ Video.propTypes = {
|
||||
fullscreenOrientation: PropTypes.oneOf(['all', 'landscape', 'portrait']),
|
||||
progressUpdateInterval: PropTypes.number,
|
||||
useTextureView: PropTypes.bool,
|
||||
useSecureView: PropTypes.bool,
|
||||
hideShutterView: PropTypes.bool,
|
||||
onLoadStart: PropTypes.func,
|
||||
onLoad: PropTypes.func,
|
||||
|
@ -41,6 +41,7 @@ public final class ExoPlayerView extends FrameLayout {
|
||||
private ViewGroup.LayoutParams layoutParams;
|
||||
|
||||
private boolean useTextureView = true;
|
||||
private boolean useSecureView = false;
|
||||
private boolean hideShutterView = false;
|
||||
|
||||
public ExoPlayerView(Context context) {
|
||||
@ -103,7 +104,15 @@ public final class ExoPlayerView extends FrameLayout {
|
||||
}
|
||||
|
||||
private void updateSurfaceView() {
|
||||
View view = useTextureView ? new TextureView(context) : new SurfaceView(context);
|
||||
View view;
|
||||
if (!useTextureView || useSecureView) {
|
||||
view = new SurfaceView(context);
|
||||
if (useSecureView) {
|
||||
((SurfaceView)view).setSecure(true);
|
||||
}
|
||||
} else {
|
||||
view = new TextureView(context);
|
||||
}
|
||||
view.setLayoutParams(layoutParams);
|
||||
|
||||
surfaceView = view;
|
||||
@ -178,6 +187,13 @@ public final class ExoPlayerView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void useSecureView(boolean useSecureView) {
|
||||
if (useSecureView != this.useSecureView) {
|
||||
this.useSecureView = useSecureView;
|
||||
updateSurfaceView();
|
||||
}
|
||||
}
|
||||
|
||||
public void setHideShutterView(boolean hideShutterView) {
|
||||
this.hideShutterView = hideShutterView;
|
||||
updateShutterViewVisibility();
|
||||
|
@ -1696,6 +1696,10 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
exoPlayerView.setUseTextureView(finallyUseTextureView);
|
||||
}
|
||||
|
||||
public void useSecureView(boolean useSecureView) {
|
||||
exoPlayerView.useSecureView(useSecureView);
|
||||
}
|
||||
|
||||
public void setHideShutterView(boolean hideShutterView) {
|
||||
exoPlayerView.setHideShutterView(hideShutterView);
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
|
||||
private static final String PROP_DISABLE_DISCONNECT_ERROR = "disableDisconnectError";
|
||||
private static final String PROP_FULLSCREEN = "fullscreen";
|
||||
private static final String PROP_USE_TEXTURE_VIEW = "useTextureView";
|
||||
private static final String PROP_SECURE_VIEW = "useSecureView";
|
||||
private static final String PROP_SELECTED_VIDEO_TRACK = "selectedVideoTrack";
|
||||
private static final String PROP_SELECTED_VIDEO_TRACK_TYPE = "type";
|
||||
private static final String PROP_SELECTED_VIDEO_TRACK_VALUE = "value";
|
||||
@ -331,6 +332,11 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
|
||||
videoView.setUseTextureView(useTextureView);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_SECURE_VIEW, defaultBoolean = true)
|
||||
public void useSecureView(final ReactExoplayerView videoView, final boolean useSecureView) {
|
||||
videoView.useSecureView(useSecureView);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_HIDE_SHUTTER_VIEW, defaultBoolean = false)
|
||||
public void setHideShutterView(final ReactExoplayerView videoView, final boolean hideShutterView) {
|
||||
videoView.setHideShutterView(hideShutterView);
|
||||
|
Loading…
Reference in New Issue
Block a user