feat(android): support hiding Exoplayer video duration on android (#4090)
* feat: support for hiding duration on Android * docs: add hideDuration property to control styles documentation
This commit is contained in:
parent
4611284247
commit
41e2bed6b3
@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReadableMap
|
|||||||
class ControlsConfig {
|
class ControlsConfig {
|
||||||
var hideSeekBar: Boolean = false
|
var hideSeekBar: Boolean = false
|
||||||
var seekIncrementMS: Int = 10000
|
var seekIncrementMS: Int = 10000
|
||||||
|
var hideDuration: Boolean = false
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@ -15,6 +16,7 @@ class ControlsConfig {
|
|||||||
if (src != null) {
|
if (src != null) {
|
||||||
config.hideSeekBar = ReactBridgeUtils.safeGetBool(src, "hideSeekBar", false)
|
config.hideSeekBar = ReactBridgeUtils.safeGetBool(src, "hideSeekBar", false)
|
||||||
config.seekIncrementMS = ReactBridgeUtils.safeGetInt(src, "seekIncrementMS", 10000)
|
config.seekIncrementMS = ReactBridgeUtils.safeGetInt(src, "seekIncrementMS", 10000)
|
||||||
|
config.hideDuration = ReactBridgeUtils.safeGetBool(src, "hideDuration", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
@ -554,7 +554,13 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
exoPosition.setLayoutParams(param);
|
exoPosition.setLayoutParams(param);
|
||||||
}else{
|
}else{
|
||||||
exoProgress.setVisibility(VISIBLE);
|
exoProgress.setVisibility(VISIBLE);
|
||||||
exoDuration.setVisibility(VISIBLE);
|
|
||||||
|
if(controlsConfig.getHideDuration()){
|
||||||
|
exoDuration.setVisibility(GONE);
|
||||||
|
}else{
|
||||||
|
exoDuration.setVisibility(VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
// Reset the layout parameters of exoPosition to their default state
|
// Reset the layout parameters of exoPosition to their default state
|
||||||
LinearLayout.LayoutParams defaultParam = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams defaultParam = new LinearLayout.LayoutParams(
|
||||||
LayoutParams.WRAP_CONTENT,
|
LayoutParams.WRAP_CONTENT,
|
||||||
|
@ -147,6 +147,7 @@ Adjust the control styles. This prop is need only if `controls={true}` and is an
|
|||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
|-----------------|---------|-----------------------------------------------------------------------------------------|
|
|-----------------|---------|-----------------------------------------------------------------------------------------|
|
||||||
| hideSeekBar | boolean | The default value is `false`, allowing you to hide the seek bar for live broadcasts. |
|
| hideSeekBar | boolean | The default value is `false`, allowing you to hide the seek bar for live broadcasts. |
|
||||||
|
| hideDuration | boolean | The default value is `false`, allowing you to hide the duration. |
|
||||||
| seekIncrementMS | number | The default value is `10000`. You can change the value to increment forward and rewind. |
|
| seekIncrementMS | number | The default value is `10000`. You can change the value to increment forward and rewind. |
|
||||||
|
|
||||||
Example with default values:
|
Example with default values:
|
||||||
@ -154,6 +155,7 @@ Example with default values:
|
|||||||
```javascript
|
```javascript
|
||||||
controlsStyles={{
|
controlsStyles={{
|
||||||
hideSeekBar: false,
|
hideSeekBar: false,
|
||||||
|
hideDuration: false,
|
||||||
seekIncrementMS: 10000,
|
seekIncrementMS: 10000,
|
||||||
}}
|
}}
|
||||||
```
|
```
|
||||||
|
@ -284,6 +284,7 @@ export type OnAudioFocusChangedData = Readonly<{
|
|||||||
|
|
||||||
type ControlsStyles = Readonly<{
|
type ControlsStyles = Readonly<{
|
||||||
hideSeekBar?: boolean;
|
hideSeekBar?: boolean;
|
||||||
|
hideDuration?: boolean;
|
||||||
seekIncrementMS?: Int32;
|
seekIncrementMS?: Int32;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
@ -223,6 +223,7 @@ export type AudioOutput = 'speaker' | 'earpiece';
|
|||||||
|
|
||||||
export type ControlsStyles = {
|
export type ControlsStyles = {
|
||||||
hideSeekBar?: boolean;
|
hideSeekBar?: boolean;
|
||||||
|
hideDuration?: boolean;
|
||||||
seekIncrementMS?: number;
|
seekIncrementMS?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user