Skip to content

Commit

Permalink
Set second argument of updateContentUrls as an object
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Dec 21, 2022
1 parent ec01e19 commit ca29e21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
13 changes: 9 additions & 4 deletions doc/api/Content_Information/updateContentUrls.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@ this method has no effect.
```js
player.updateContentUrls(urls);
// or
player.updateContentUrls(urls, refreshNow);
player.updateContentUrls(urls, params);
```

- **arguments**:

1. _urls_ `Array.<string>|under`: URLs to reach that content / Manifest
from the most prioritized URL to the least prioritized URL.

2. _refreshNow_ `boolean`: If `true` the resource in question (e.g.
DASH's MPD) will be refreshed immediately.
2. _params_ `Object|undefined`: Optional parameters linked to this URL
change.

Can contain the following properties:

- _refresh_ `boolean`: If `true` the resource in question (e.g.
DASH's MPD) will be refreshed immediately.

## Examples

Expand All @@ -52,5 +57,5 @@ player.updateContentUrls([
player.updateContentUrls(undefined);

// Update and ask to refresh immediately
player.updateContentUrls(["http://my.new.url"], true);
player.updateContentUrls(["http://my.new.url"], { refresh: true });
```
11 changes: 8 additions & 3 deletions src/core/api/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1134,13 +1134,18 @@ class Player extends EventEmitter<IPublicAPIEvent> {
* Update URL of the content currently being played (e.g. DASH's MPD).
* @param {Array.<string>|undefined} urls - URLs to reach that content /
* Manifest from the most prioritized URL to the least prioritized URL.
* @param {boolean} refreshNow - If `true` the resource in question (e.g.
* DASH's MPD) will be refreshed immediately.
* @param {Object|undefined} [params]
* @param {boolean} params.refresh - If `true` the resource in question
* (e.g. DASH's MPD) will be refreshed immediately.
*/
public updateContentUrls(urls : string[] | undefined, refreshNow : boolean) : void {
public updateContentUrls(
urls : string[] | undefined,
params? : { refresh?: boolean } | undefined
) : void {
if (this._priv_contentInfos === null) {
throw new Error("No content loaded");
}
const refreshNow = params?.refresh === true;
this._priv_contentInfos.initializer.updateContentUrls(urls, refreshNow);
}

Expand Down

0 comments on commit ca29e21

Please sign in to comment.