Skip to content

Commit

Permalink
Merge branch 'main' into media-playlist-basic-info
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Dec 13, 2022
2 parents cc18033 + da0b818 commit 38d0636
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 14 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ jobs:
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'Firefox'
run: sudo apt -y update && sudo apt -y install ffmpeg

# Edge 107 fails DRM tests due to an outdated Widevine CDM. Force Edge
# to update to 108+.
- name: Upgrade Edge
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'Edge'
run: |
# If it's Edge 107, update it. Otherwise, don't. This way, we don't
# break something later when Edge 108+ is available by default in
# GitHub Actions.
if apt show microsoft-edge-stable | grep -q '^Version: 107'; then
wget https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_108.0.1462.46-1_amd64.deb
sudo dpkg -i microsoft-edge-stable_108.0.1462.46-1_amd64.deb
fi
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Prakash <[email protected]>
Robert Colantuoni <[email protected]>
Robert Galluccio <[email protected]>
Rodolphe Breton <[email protected]>
Rohan Gupta <[email protected]>
Roi Lipman <[email protected]>
Roksolana Ivanyshyn <[email protected]>
Rostislav Hejduk <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Robert Colantuoni <[email protected]>
Robert Galluccio <[email protected]>
Rodolphe Breton <[email protected]>
Rohit Makasana <[email protected]>
Rohan Gupta <[email protected]>
Roi Lipman <[email protected]>
Roksolana Ivanyshyn <[email protected]>
Rostislav Hejduk <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ HLS features supported:
- CEA-608/708 captions
- Encrypted content with PlayReady and Widevine
- Encrypted content with FairPlay (Safari on macOS and iOS 13+ only)
- Key rotation
- Raw AAC, MP3, etc (without an MP4 container)

HLS features **not** supported:
- Key rotation: https://github.com/shaka-project/shaka-player/issues/917
- I-frame-only playlists: https://github.com/shaka-project/shaka-player/issues/742
- Low-latency streaming with blocking playlist reload

Expand Down
6 changes: 5 additions & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4347,6 +4347,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
return [];
}
const chapters = [];
const uniqueChapters = new Set();
for (const chaptersTrack of chaptersTracksWithLanguage) {
if (chaptersTrack && chaptersTrack.cues) {
for (const cue of chaptersTrack.cues) {
Expand All @@ -4361,7 +4362,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
startTime: cue.startTime,
endTime: cue.endTime,
};
chapters.push(chapter);
if (!uniqueChapters.has(id)) {
chapters.push(chapter);
uniqueChapters.add(id);
}
}
}
}
Expand Down
40 changes: 29 additions & 11 deletions test/test/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,40 @@ function failTestsOnNamespacedElementOrAttributeNames() {
}

/**
* Listen for unhandled Promise rejections (which may occur after a test) and
* convert them into test failures.
* Fail the current test on a given error, constructed with a given header and
* the full stack trace of the error.
*
* @param {string} messageHeader
* @param {!Error} error
*/
function failTestsOnUnhandledRejections() {
function failOnError(messageHeader, error) {
let message = `${messageHeader}: ${error}`;
// Shaka errors have the stack trace in their toString() already, so don't
// add it again. For native errors, we need to see where it came from.
if (error && error.stack && !(error instanceof shaka.util.Error)) {
message += '\n' + error.stack;
}
fail(message);
}

/**
* Listen for unhandled errors and Promise rejections (which may occur after a
* test) and convert them into test failures.
*/
function failTestsOnUnhandledErrors() {
// https://developer.mozilla.org/en-US/docs/Web/Events/unhandledrejection
window.addEventListener('unhandledrejection', (event) => {
/** @type {?} */
const error = event.reason;
let message = 'Unhandled rejection in Promise: ' + error;
failOnError('Unhandled rejection in Promise', error);
});

// Shaka errors have the stack trace in their toString() already, so don't
// add it again. For native errors, we need to see where it came from.
if (error && error.stack && !(error instanceof shaka.util.Error)) {
message += '\n' + error.stack;
}
fail(message);
// https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event
// https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent
window.addEventListener('error', (event) => {
/** @type {?} */
const error = event['error'];
failOnError('Unhandled error', error);
});
}

Expand Down Expand Up @@ -392,7 +410,7 @@ function configureJasmineEnvironment() {
function setupTestEnvironment() {
failTestsOnFailedAssertions();
failTestsOnNamespacedElementOrAttributeNames();
failTestsOnUnhandledRejections();
failTestsOnUnhandledErrors();
disableScrollbars();
workAroundLegacyEdgePromiseIssues();

Expand Down
6 changes: 5 additions & 1 deletion ui/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,11 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
if (this.config_.forceLandscapeOnFullscreen && screen.orientation) {
// Locking to 'landscape' should let it be either
// 'landscape-primary' or 'landscape-secondary' as appropriate.
await screen.orientation.lock('landscape');
// We ignore errors from this specific call, since it creates noise
// on desktop otherwise.
try {
await screen.orientation.lock('landscape');
} catch (error) {}
}
} else {
const video = /** @type {HTMLVideoElement} */(this.localVideo_);
Expand Down

0 comments on commit 38d0636

Please sign in to comment.