Skip to content

Commit

Permalink
fix(ReactExoplayerView): disable audio focus
Browse files Browse the repository at this point in the history
Fix when component initialize, the 'requestAudioFocus' method always request the focus to 'AudioManager' even when the property 'disableFocus' is passed by parameter.
The 'disableFocus' need to be started with 'true' value and a call to 'requestAudioFocus' inside the 'setDisableFocus' need to be perfom to update it.
  • Loading branch information
alanpazetto committed Apr 26, 2019
1 parent ba159c3 commit 252562d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ export default class Video extends Component {
}
}

Video.defaultProps = {
disableFocus: false
};

Video.propTypes = {
/* Native only */
src: PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ReactExoplayerView extends FrameLayout implements
private String textTrackType;
private Dynamic textTrackValue;
private ReadableArray textTracks;
private boolean disableFocus;
private boolean disableFocus = true;
private float mProgressUpdateInterval = 250.0f;
private boolean playInBackground = false;
private boolean useTextureView = false;
Expand Down Expand Up @@ -900,6 +900,7 @@ public void setPlayInBackground(boolean playInBackground) {

public void setDisableFocus(boolean disableFocus) {
this.disableFocus = disableFocus;
requestAudioFocus();
}

public void setFullscreen(boolean fullscreen) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-video",
"version": "3.2.0",
"version": "3.2.1",
"description": "A <Video /> element for react-native",
"main": "Video.js",
"license": "MIT",
Expand Down

0 comments on commit 252562d

Please sign in to comment.