-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue arising when a track at the exact last possible position of…
… a Period with no consecutive Period We found out that an issue prevented from switching the track when the current position was exactly at the position indicated by a Period's `end` property if there was no immediately consecutive Period. For example if a content had, as a last Period, one starting at position `10` (seconds) and ending at `30`, and if the player was currently paused at position `30` a `setAudioTrack` or any track switching call wouldn't have any effect. This is because the logic handling which Period should currently be handled decides that a Period finishes as soon as we reached the position indicated by its `end` property. Because under that logic we're not playing the last Period anymore when we reached it, API updating tracks of the current Period do not have any effect. It actually makes perfect sense for the frequent usecase of having consecutive Periods, where the `end` of one is equal to the `start` of the following one (in which case the following one has priority, so finishing the previous Period is wanted here), but it begins to show weird behaviors like the one described here when a Period's `end` is not shared with a consecutive Period, in which case we could (and probably should) consider that `end` position as part of that Period instead as there's no such ambiguity. So this commit actually explicitely handle that case, which fixes the issue.
- Loading branch information
1 parent
ffc1a5d
commit d1a72d9
Showing
2,278 changed files
with
197,341 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare const blobURL: string; | ||
export { blobURL as EMBEDDED_DASH_WASM }; | ||
export default blobURL; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare const blobURL: string; | ||
export { blobURL as EMBEDDED_WORKER }; | ||
export default blobURL; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { EMBEDDED_DASH_WASM } from "./embedded_dash_wasm"; | ||
export { EMBEDDED_WORKER } from "./embedded_worker"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EMBEDDED_WORKER = exports.EMBEDDED_DASH_WASM = void 0; | ||
var embedded_dash_wasm_1 = require("./embedded_dash_wasm"); | ||
Object.defineProperty(exports, "EMBEDDED_DASH_WASM", { enumerable: true, get: function () { return embedded_dash_wasm_1.EMBEDDED_DASH_WASM; } }); | ||
var embedded_worker_1 = require("./embedded_worker"); | ||
Object.defineProperty(exports, "EMBEDDED_WORKER", { enumerable: true, get: function () { return embedded_worker_1.EMBEDDED_WORKER; } }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright 2015 CANAL+ Group | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* Add className to an HTMLElement. Do nothing if the className was already | ||
* added. | ||
* @param {HTMLElement} elt | ||
* @param {string} className | ||
*/ | ||
export default function addClassName(elt: HTMLElement, className: string): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"use strict"; | ||
/** | ||
* Copyright 2015 CANAL+ Group | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var hasClassList; | ||
/** | ||
* Add className to an HTMLElement. Do nothing if the className was already | ||
* added. | ||
* @param {HTMLElement} elt | ||
* @param {string} className | ||
*/ | ||
function addClassName(elt, className) { | ||
if (hasClassList === undefined) { | ||
hasClassList = elt.classList !== undefined && | ||
/* eslint-disable @typescript-eslint/unbound-method */ | ||
typeof elt.classList.add === "function"; | ||
/* eslint-enable @typescript-eslint/unbound-method */ | ||
} | ||
if (hasClassList) { | ||
elt.classList.add(className); | ||
} | ||
else { | ||
var classNamesWithSpaces = " " + elt.className + " "; | ||
if (classNamesWithSpaces.indexOf(" " + className + " ") < 0) { | ||
elt.className += " " + className; | ||
} | ||
} | ||
} | ||
exports.default = addClassName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright 2015 CANAL+ Group | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { ICompatTextTrack } from "./browser_compatibility_types"; | ||
/** | ||
* Add text track to the given media element. | ||
* | ||
* Returns an object with the following properties: | ||
* - track {TextTrack}: the added text track | ||
* - trackElement {HTMLElement|undefined}: the added <track> element. | ||
* undefined if no trackElement was added. | ||
* | ||
* @param {HTMLMediaElement} mediaElement | ||
* @returns {Object} | ||
*/ | ||
export default function addTextTrack(mediaElement: HTMLMediaElement): { | ||
track: ICompatTextTrack; | ||
trackElement: HTMLTrackElement | undefined; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"use strict"; | ||
/** | ||
* Copyright 2015 CANAL+ Group | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var browser_detection_1 = require("./browser_detection"); | ||
/** | ||
* Add text track to the given media element. | ||
* | ||
* Returns an object with the following properties: | ||
* - track {TextTrack}: the added text track | ||
* - trackElement {HTMLElement|undefined}: the added <track> element. | ||
* undefined if no trackElement was added. | ||
* | ||
* @param {HTMLMediaElement} mediaElement | ||
* @returns {Object} | ||
*/ | ||
function addTextTrack(mediaElement) { | ||
var _a; | ||
var track; | ||
var trackElement; | ||
var kind = "subtitles"; | ||
if (browser_detection_1.isIEOrEdge) { | ||
var tracksLength = mediaElement.textTracks.length; | ||
track = (tracksLength > 0 ? mediaElement.textTracks[tracksLength - 1] : | ||
mediaElement.addTextTrack(kind)); | ||
track.mode = (_a = track.SHOWING) !== null && _a !== void 0 ? _a : "showing"; | ||
} | ||
else { | ||
trackElement = document.createElement("track"); | ||
mediaElement.appendChild(trackElement); | ||
track = trackElement.track; | ||
trackElement.kind = kind; | ||
track.mode = "showing"; | ||
} | ||
return { track: track, trackElement: trackElement }; | ||
} | ||
exports.default = addTextTrack; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
/** | ||
* Copyright 2015 CANAL+ Group | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** Regular MediaKeys type + optional functions present in IE11. */ | ||
interface ICompatMediaKeysConstructor { | ||
isTypeSupported?: (type: string) => boolean; | ||
new (keyType?: string): MediaKeys; | ||
} | ||
/** | ||
* Browser implementation of a VTTCue constructor. | ||
* TODO open TypeScript issue about it? | ||
*/ | ||
type ICompatVTTCueConstructor = new (start: number, end: number, cueText: string) => ICompatVTTCue; | ||
/** Browser implementation for a single VTTCue. */ | ||
interface ICompatVTTCue { | ||
align: string; | ||
endTime: number; | ||
id: string; | ||
line: number | "auto"; | ||
lineAlign: string; | ||
position: number | "auto"; | ||
positionAlign: string; | ||
size: number | string; | ||
snapToLines: boolean; | ||
startTime: number; | ||
vertical: string; | ||
} | ||
/** | ||
* Overriden TextTrack browser implementation, to also include our own | ||
* definition of a VTTCue. | ||
*/ | ||
interface ICompatTextTrack extends TextTrack { | ||
addCue(cue: TextTrackCue | ICompatVTTCue): void; | ||
removeCue(cue: TextTrackCue | ICompatVTTCue): void; | ||
HIDDEN?: "hidden"; | ||
SHOWING?: "showing"; | ||
} | ||
/** | ||
* Browser implementation of the `document` object with added optional vendored | ||
* functions for some "old" browsers. | ||
*/ | ||
interface ICompatDocument extends Document { | ||
mozHidden?: boolean; | ||
msHidden?: boolean; | ||
webkitHidden?: boolean; | ||
} | ||
/** | ||
* HTMLMediaElement with added optional vendored functions used by "old" | ||
* browsers. | ||
* And TypeScript forgot to add assiociated AudioTrackList and VideoTrackList | ||
* (and yes apparently a HTMLAudioElement can have an assiociated | ||
* VideoTrackList). | ||
* | ||
* Note: I prefer to define my own `ICompatHTMLMediaElement` rather to extend | ||
* the original definition to better detect which types have been extended and | ||
* are not actually valid TypeScript types. | ||
*/ | ||
interface ICompatHTMLMediaElement extends HTMLMediaElement { | ||
mozRequestFullScreen?: () => void; | ||
msRequestFullscreen?: () => void; | ||
webkitRequestFullscreen?: () => void; | ||
webkitSupportsPresentationMode?: boolean; | ||
webkitSetPresentationMode?: () => void; | ||
webkitPresentationMode?: string; | ||
mozSetMediaKeys?: (mediaKeys: unknown) => void; | ||
msSetMediaKeys?: (mediaKeys: unknown) => void; | ||
webkitSetMediaKeys?: (mediaKeys: unknown) => void; | ||
webkitKeys?: { | ||
createSession?: (mimeType: string, initData: BufferSource) => MediaKeySession; | ||
}; | ||
readonly audioTracks?: ICompatAudioTrackList; | ||
readonly videoTracks?: ICompatVideoTrackList; | ||
} | ||
/** | ||
* AudioTrackList implementation (that TS forgot). | ||
* Directly taken from the WHATG spec: | ||
* https://html.spec.whatwg.org/multipage/media.html#audiotracklist | ||
*/ | ||
interface ICompatAudioTrackList extends EventTarget { | ||
readonly length: number; | ||
getTrackById(id: string): ICompatAudioTrack; | ||
onchange?: ((n: Event) => void) | null; | ||
onaddtrack?: ((n: Event) => void) | null; | ||
onremovetrack?: ((n: Event) => void) | null; | ||
[x: number]: ICompatAudioTrack; | ||
} | ||
/** | ||
* AudioTrack implementation (that TS forgot). | ||
* Directly taken from the WHATG spec: | ||
* https://html.spec.whatwg.org/multipage/media.html#audiotracklist | ||
*/ | ||
interface ICompatAudioTrack { | ||
id: string; | ||
kind: string; | ||
label: string; | ||
language: string; | ||
enabled: boolean; | ||
} | ||
/** | ||
* VideoTrackList implementation (that TS forgot). | ||
* Directly taken from the WHATG spec: | ||
* https://html.spec.whatwg.org/multipage/media.html#audiotracklist | ||
*/ | ||
interface ICompatVideoTrackList extends EventTarget { | ||
readonly length: number; | ||
selectedIndex: number; | ||
getTrackById(id: string): ICompatVideoTrack; | ||
onchange?: ((n: Event) => void) | null; | ||
onaddtrack?: ((n: Event) => void) | null; | ||
onremovetrack?: ((n: Event) => void) | null; | ||
[x: number]: ICompatVideoTrack; | ||
} | ||
/** | ||
* VideoTrack implementation (that TS forgot). | ||
* Directly taken from the WHATG spec: | ||
* https://html.spec.whatwg.org/multipage/media.html#audiotracklist | ||
*/ | ||
interface ICompatVideoTrack { | ||
id: string; | ||
kind: string; | ||
label: string; | ||
language: string; | ||
selected: boolean; | ||
} | ||
/** | ||
* Browser implementation of a Picture in picture window, as defined in the the | ||
* draft from the W3C: | ||
* https://wicg.github.io/picture-in-picture/#pictureinpicturewindow | ||
*/ | ||
export interface ICompatPictureInPictureWindow extends EventTarget { | ||
width: number; | ||
height: number; | ||
} | ||
declare const MediaSource_: typeof MediaSource | undefined; | ||
/** List an HTMLMediaElement's possible values for its readyState property. */ | ||
declare const READY_STATES: { | ||
HAVE_NOTHING: number; | ||
HAVE_METADATA: number; | ||
HAVE_CURRENT_DATA: number; | ||
HAVE_FUTURE_DATA: number; | ||
HAVE_ENOUGH_DATA: number; | ||
}; | ||
/** | ||
* TextTrackList browser implementation. | ||
* TODO W3C defines onremovetrack and onchange attributes which are not present on | ||
* ts type definition, open a TS issue? | ||
*/ | ||
export interface ICompatTextTrackList extends TextTrackList { | ||
onremovetrack: ((ev: TrackEvent) => void) | null; | ||
onchange: (() => void) | null; | ||
} | ||
export { ICompatDocument, ICompatHTMLMediaElement, ICompatAudioTrackList, ICompatVideoTrackList, ICompatAudioTrack, ICompatVideoTrack, ICompatMediaKeysConstructor, ICompatTextTrack, ICompatVTTCue, ICompatVTTCueConstructor, MediaSource_, READY_STATES, }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"use strict"; | ||
/** | ||
* Copyright 2015 CANAL+ Group | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.READY_STATES = exports.MediaSource_ = void 0; | ||
var is_null_or_undefined_1 = require("../utils/is_null_or_undefined"); | ||
var global_scope_1 = require("./global_scope"); | ||
/* eslint-disable */ | ||
/** MediaSource implementation, including vendored implementations. */ | ||
var gs = global_scope_1.default; | ||
var MediaSource_ = gs === undefined ? undefined : | ||
!(0, is_null_or_undefined_1.default)(gs.MediaSource) ? gs.MediaSource : | ||
!(0, is_null_or_undefined_1.default)(gs.MozMediaSource) ? gs.MozMediaSource : | ||
!(0, is_null_or_undefined_1.default)(gs.WebKitMediaSource) ? gs.WebKitMediaSource : | ||
gs.MSMediaSource; | ||
exports.MediaSource_ = MediaSource_; | ||
/* eslint-enable */ | ||
/** List an HTMLMediaElement's possible values for its readyState property. */ | ||
var READY_STATES = { HAVE_NOTHING: 0, | ||
HAVE_METADATA: 1, | ||
HAVE_CURRENT_DATA: 2, | ||
HAVE_FUTURE_DATA: 3, | ||
HAVE_ENOUGH_DATA: 4 }; | ||
exports.READY_STATES = READY_STATES; |
Oops, something went wrong.