Skip to content

Commit

Permalink
Merge branch 'release/v3.30.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Mar 7, 2023
2 parents 074ba45 + ebfb000 commit ebd1266
Show file tree
Hide file tree
Showing 296 changed files with 28,139 additions and 28,909 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ module.exports = {
"plugins": [
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"ban",
"@typescript-eslint",
"@typescript-eslint/tslint"
],
"rules": {
"ban/ban": [
2,
{
"name": ["*", "finally"],
"message": "Promise.prototype.finally is forbidden due to poor support from older devices.\nNote that this linting rule just bans naively all \"finally\" method calls, if in this case it wasn't called on a Promise, you can safely ignore this error",
}
],
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"error",
Expand Down
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Changelog

## v3.30.0 (2023-03-07)

### Features

- Add `updateContentUrls` API, allowing to update the Manifest's URL during playback [#1182]
- DASH: implement forced-subtitles, adding the `forced` property to the audio tracks API and selecting by default a forced text track linked to the audio track's language if present [#1187]
- DRM: add the `getKeySystemConfiguration` method to the RxPlayer [#1202]
- add experimental `DEBUG_ELEMENT` feature and `createDebugElement` method to render a default debugging HTML element [#1200]

### Deprecated

- Deprecate the `getVideoLoadedTime` method which can be easily replaced (see Deprecated method documentation)
- Deprecate the `getVideoPlayedTime` method which can be easily replaced (see Deprecated method documentation)
- Deprecate the `transportOptions.aggressiveMode` option
- DRM: Deprecate the `keySystems[].onKeyStatusesChange` callback as no good use case was found for it.

### Bug fixes

- Fix segment requesting error when playing a DASH content without an url and without BaseURL elements [#1192]
- API: Stop sending events if the content is stopped due to a side-effect of one of the event handler [#1197]
- text-tracks/ttml: fix inconsistent line spacing when resizing the `textTrackElement` [#1191]
- DRM: Fix race condition leading to a JS error instead of a `NO_PLAYABLE_REPRESENTATION` [#1201]
- DRM/Compat: Renew MediaKeys at each `loadVideo` on all WebOS (LG TV) platforms to work around issues [#1188]

### Other improvements

- DASH: better detect closed captions [#1187]
- DASH: handle `endNumber` DASH attribute [#1186]
- Support encrypted contents on Panasonic 2019 TVs [#1226]
- Better handle SourceBuffer's QuotaExceededError, responsible for `MediaError` with the `BUFFER_FULL_ERROR` code [#1221]
- API: send available...TracksChange events in the very unlikely scenario where tracks are added after a manifest update [#1197]
- Completely remove RxJS dependency from the RxPlayer's source code [#1193]
- DRM: Request PR recommendation when PlayReady is asked and try default recommendation robustnesses [#1189]


## v3.29.0 (2022-11-16)

### Features
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.29.0
3.30.0
266 changes: 150 additions & 116 deletions demo/full/scripts/components/Options/AudioAdaptiveSettings.jsx
Original file line number Diff line number Diff line change
@@ -1,164 +1,198 @@
import React, { Fragment, useState } from "react";

import React, { Fragment, useCallback, useEffect, useState } from "react";
import getCheckBoxValue from "../../lib/getCheckboxValue";
import Checkbox from "../../components/CheckBox";
import Button from "../Button";
import DEFAULT_VALUES from "../../lib/defaultOptionsValues";
import PlayerOptionNumberInput from "./PlayerOptionNumberInput";

const defaultInitialAudioBitrate = DEFAULT_VALUES.player.initialAudioBitrate;
const defaultMinAudioBitrate = DEFAULT_VALUES.player.minAudioBitrate;
const defaultMaxAudioBitrate = DEFAULT_VALUES.player.maxAudioBitrate;

/**
* @param {Object} props
* @returns {Object}
*/
function AudioAdaptiveSettings({
initialAudioBr,
minAudioBr,
maxAudioBr,
onInitialAudioBrInput,
onMinAudioBrInput,
onMaxAudioBrInput,
initialAudioBitrate,
minAudioBitrate,
maxAudioBitrate,
onInitialAudioBitrateChange,
onMinAudioBitrateChange,
onMaxAudioBitrateChange,
}) {
const [isMinAudioBrLimited, setMinAudioBrLimit] = useState(minAudioBr !== 0);
const [isMaxAudioBrLimited, setMaxAudioBrLimit] = useState(
maxAudioBr !== Infinity
/* Value of the `initialVideoBitrate` input */
const [initialAudioBitrateStr, setInitialAudioBitrateStr] = useState(
String(initialAudioBitrate)
);
/* Value of the `minAudioBitrate` input */
const [minAudioBitrateStr, setMinAudioBitrateStr] = useState(
String(minAudioBitrate)
);
/* Value of the `maxAudioBitrate` input */
const [maxAudioBitrateStr, setMaxAudioBitrateStr] = useState(
String(maxAudioBitrate)
);
/*
* Keep track of the "limit minAudioBitrate" toggle:
* `false` == checkbox enabled
*/
const [isMinAudioBitrateLimited, setMinAudioBitrateLimit] = useState(
minAudioBitrate !== 0
);
/*
* Keep track of the "limit maxAudioBitrate" toggle:
* `false` == checkbox enabled
*/
const [isMaxAudioBitrateLimited, setMaxAudioBitrateLimit] = useState(
maxAudioBitrate !== Infinity
);

const onChangeLimitMinAudioBr = (evt) => {
// Update initialAudioBitrate when its linked text change
useEffect(() => {
// Note that this unnecessarily also run on first render - there seem to be
// no quick and easy way to disable this in react.
// This is not too problematic so I put up with it.
let newBitrate = parseFloat(initialAudioBitrateStr);
newBitrate = isNaN(newBitrate) ?
defaultInitialAudioBitrate :
newBitrate;
onInitialAudioBitrateChange(newBitrate);
}, [initialAudioBitrateStr]);

// Update minAudioBitrate when its linked text change
useEffect(() => {
let newBitrate = parseFloat(minAudioBitrateStr);
newBitrate = isNaN(newBitrate) ?
defaultMinAudioBitrate :
newBitrate;
onMinAudioBitrateChange(newBitrate);
}, [minAudioBitrateStr]);

// Update maxAudioBitrate when its linked text change
useEffect(() => {
let newBitrate = parseFloat(maxAudioBitrateStr);
newBitrate = isNaN(newBitrate) ?
defaultMaxAudioBitrate :
newBitrate;
onMaxAudioBitrateChange(newBitrate);
}, [maxAudioBitrateStr]);

const onChangeLimitMinAudioBitrate = useCallback((evt) => {
const isNotLimited = getCheckBoxValue(evt.target);
if (isNotLimited) {
setMinAudioBrLimit(false);
onMinAudioBrInput(0);
setMinAudioBitrateLimit(false);
setMinAudioBitrateStr(String(0));
} else {
setMinAudioBrLimit(true);
onMinAudioBrInput(DEFAULT_VALUES.minAudioBr);
setMinAudioBitrateLimit(true);
setMinAudioBitrateStr(String(defaultMinAudioBitrate));
}
};
}, []);

const onChangeLimitMaxAudioBr = (evt) => {
const onChangeLimitMaxAudioBitrate = useCallback((evt) => {
const isNotLimited = getCheckBoxValue(evt.target);
if (isNotLimited) {
setMaxAudioBrLimit(false);
onMaxAudioBrInput(Infinity);
setMaxAudioBitrateLimit(false);
setMaxAudioBitrateStr(String(Infinity));
} else {
setMaxAudioBrLimit(true);
onMaxAudioBrInput(DEFAULT_VALUES.maxAudioBr);
setMaxAudioBitrateLimit(true);
setMaxAudioBitrateStr(String(defaultMaxAudioBitrate));
}
};
}, []);

return (
<Fragment>
<li>
<div className="playerOptionInput">
<label htmlFor="initialAudioBitrate">Initial Audio Bitrate</label>
<span className="wrapperInputWithResetBtn">
<input
type="number"
name="initialAudioBitrate"
id="initialAudioBitrate"
aria-label="Initial audio bitrate option"
placeholder="Number"
onChange={(evt) => onInitialAudioBrInput(evt.target.value)}
value={initialAudioBr}
className="optionInput"
/>
<Button
className={
parseFloat(initialAudioBr) === DEFAULT_VALUES.initialAudioBr
? "resetBtn disabledResetBtn"
: "resetBtn"
}
ariaLabel="Reset option to default value"
title="Reset option to default value"
onClick={() => {
onInitialAudioBrInput(DEFAULT_VALUES.initialAudioBr);
}}
value={String.fromCharCode(0xf021)}
/>
</span>
</div>
<PlayerOptionNumberInput
ariaLabel="Initial audio bitrate option"
label="initialAudioBitrate"
title="Initial Audio Bitrate"
valueAsString={initialAudioBitrateStr}
defaultValueAsNumber={defaultInitialAudioBitrate}
isDisabled={false}
onUpdateValue={setInitialAudioBitrateStr}
onResetClick={() => {
setInitialAudioBitrateStr(String(
defaultInitialAudioBitrate
));
}}
/>
<span className="option-desc">
{
initialAudioBitrate === 0 ?
"Starts loading the lowest audio bitrate" :
`Starts with an audio bandwidth estimate of ${initialAudioBitrate}` +
" bits per seconds."
}
</span>
</li>
<li>
<div className="playerOptionInput">
<label htmlFor="minAudioBitrate">Min Audio Bitrate</label>
<span className="wrapperInputWithResetBtn">
<input
type="number"
name="minAudioBitrate"
id="minAudioBitrate"
aria-label="Min audio bitrate option"
placeholder="Number"
onChange={(evt) => onMinAudioBrInput(evt.target.value)}
value={minAudioBr}
disabled={isMinAudioBrLimited === false}
className="optionInput"
/>
<Button
className={
parseFloat(minAudioBr) === DEFAULT_VALUES.minAudioBr
? "resetBtn disabledResetBtn"
: "resetBtn"
}
ariaLabel="Reset option to default value"
title="Reset option to default value"
onClick={() => {
setMinAudioBrLimit(DEFAULT_VALUES.minAudioBr !== 0);
onMinAudioBrInput(DEFAULT_VALUES.minAudioBr);
}}
value={String.fromCharCode(0xf021)}
/>
</span>
</div>
<PlayerOptionNumberInput
ariaLabel="Min audio bitrate option"
label="minAudioBitrate"
title="Min Audio Bitrate"
valueAsString={minAudioBitrateStr}
defaultValueAsNumber={defaultMinAudioBitrate}
isDisabled={isMinAudioBitrateLimited === false}
onUpdateValue={setMinAudioBitrateStr}
onResetClick={() => {
setMinAudioBitrateStr(String(defaultMinAudioBitrate));
setMinAudioBitrateLimit(defaultMinAudioBitrate !== 0);
}}
/>
<Checkbox
className="playerOptionsCheckBox"
ariaLabel="Min video bitrate limit"
name="minAudioBitrateLimit"
checked={isMinAudioBrLimited === false}
onChange={onChangeLimitMinAudioBr}
checked={isMinAudioBitrateLimited === false}
onChange={onChangeLimitMinAudioBitrate}
>
Do not limit
</Checkbox>
<span className="option-desc">
{
!isMinAudioBitrateLimited || minAudioBitrate <= 0 ?
"Not limiting the lowest audio bitrate reachable through the adaptive logic" :
"Limiting the lowest audio bitrate reachable through the adaptive " +
`logic to ${minAudioBitrate} bits per seconds`
}
</span>
</li>
<li>
<div className="playerOptionInput">
<label htmlFor="maxAudioBitrate">Max Audio Bitrate</label>
<span className="wrapperInputWithResetBtn">
<input
type="text"
name="maxAudioBitrate"
id="maxAudioBitrate"
aria-label="Max audio bitrate"
placeholder="Number"
onChange={(evt) => onMaxAudioBrInput(evt.target.value)}
value={String(maxAudioBr)}
disabled={isMaxAudioBrLimited === false}
className="optionInput"
/>
<Button
className={
parseFloat(maxAudioBr) === DEFAULT_VALUES.maxAudioBr
? "resetBtn disabledResetBtn"
: "resetBtn"
}
ariaLabel="Reset option to default value"
title="Reset option to default value"
onClick={() => {
setMaxAudioBrLimit(DEFAULT_VALUES.maxAudioBr !== Infinity);
onMaxAudioBrInput(DEFAULT_VALUES.maxAudioBr);
}}
value={String.fromCharCode(0xf021)}
/>
</span>
</div>
<PlayerOptionNumberInput
ariaLabel="Max audio bitrate option"
label="maxAudioBitrate"
title="Max Audio Bitrate"
valueAsString={maxAudioBitrateStr}
defaultValueAsNumber={defaultMaxAudioBitrate}
isDisabled={isMaxAudioBitrateLimited === false}
onUpdateValue={setMaxAudioBitrateStr}
onResetClick={() => {
setMaxAudioBitrateStr(String(defaultMaxAudioBitrate));
setMaxAudioBitrateLimit(defaultMaxAudioBitrate !== Infinity);
}}
/>
<div>
<Checkbox
className="playerOptionsCheckBox"
ariaLabel="Max audio bitrate limit"
name="maxAudioBitrateLimit"
checked={isMaxAudioBrLimited === false}
onChange={onChangeLimitMaxAudioBr}
checked={isMaxAudioBitrateLimited === false}
onChange={onChangeLimitMaxAudioBitrate}
>
Do not limit
</Checkbox>
</div>
<span className="option-desc">
{
!isMaxAudioBitrateLimited || parseFloat(
maxAudioBitrate
) === Infinity ?
"Not limiting the highest audio bitrate reachable through " +
"the adaptive logic" :
"Limiting the highest audio bitrate reachable through the " +
`adaptive logic to ${maxAudioBitrate} bits per seconds`
}
</span>
</li>
</Fragment>
);
Expand Down
Loading

0 comments on commit ebd1266

Please sign in to comment.