Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: target-live-window unneeded sprout #852

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ <h1><a href="/">Elements</a></h1>

<mux-player
theme="classic"
stream-type="live:dvr"
stream-type="live"
target-live-window="Infinity"
playback-id="v69RSHhFelSm4701snP22dYz2jICy4E4FUyk02rW4gxRM"
title="My amazing video"
></mux-player>
Expand Down
3 changes: 2 additions & 1 deletion examples/vanilla-ts-esm/public/mux-player.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ <h1><a href="/">Elements</a></h1>
></mux-player>

<mux-player
stream-type="live:dvr"
stream-type="live"
target-live-window="Infinity"
playback-id="v69RSHhFelSm4701snP22dYz2jICy4E4FUyk02rW4gxRM"
title="My amazing video"
></mux-player>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"lerna": "^4.0.0",
"prettier": "^2.3.2",
"pretty-quick": "^3.1.1",
"turbo": "^1.11.0"
"turbo": "^1.11.2"
},
"workspaces": [
"packages/*",
Expand Down
15 changes: 6 additions & 9 deletions packages/mux-player/scripts/build-themes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ for (const theme of themes) {
outdir: `./dist/themes/${theme}`,
};

await esbuild.build(esm);

if (devMode) {
const context = await esbuild.context(esm);
await context.rebuild();
await context.watch();
} else {
await esbuild.build(esm);
}

//@ts-ignore
Expand All @@ -43,12 +42,11 @@ for (const theme of themes) {
outdir: `./dist/themes/${theme}`,
};

await esbuild.build(cjs);

if (devMode) {
const context = await esbuild.context(cjs);
await context.rebuild();
await context.watch();
} else {
await esbuild.build(cjs);
}

//@ts-ignore
Expand All @@ -60,11 +58,10 @@ for (const theme of themes) {
outdir: `./dist/themes/${theme}`,
};

await esbuild.build(iife);

if (devMode) {
const context = await esbuild.context(iife);
await context.rebuild();
await context.watch();
} else {
await esbuild.build(iife);
}
}
11 changes: 9 additions & 2 deletions packages/mux-player/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,14 @@ class MuxPlayerElement extends VideoApiElement implements MuxPlayerElement {
// NOTE: For now, since we are continuing support of the deprecated stream types (namely, "dvr" types) and not advertising the
// new APIs such as `targetLiveWindow`/`target-live-window`, we will (presumpuously) update the `targetLiveWindow` based on the
// stream type (CJP).
this.targetLiveWindow = newValue === StreamTypes.LIVE ? 0 : Number.NaN;
if (newValue === StreamTypes.LIVE) {
// Don't override if the user has already set a value.
if (this.getAttribute(PlayerAttributes.TARGET_LIVE_WINDOW) == null) {
this.targetLiveWindow = 0;
}
} else {
this.targetLiveWindow = Number.NaN;
}
}
}
}
Expand Down Expand Up @@ -1382,7 +1389,7 @@ class MuxPlayerElement extends VideoApiElement implements MuxPlayerElement {

set targetLiveWindow(val: number | undefined) {
// don't cause an infinite loop and avoid change event dispatching
if (val == this.targetLiveWindow) return;
if (val == this.targetLiveWindow || (Number.isNaN(val) && Number.isNaN(this.targetLiveWindow))) return;

if (val == null) {
this.removeAttribute(PlayerAttributes.TARGET_LIVE_WINDOW);
Expand Down
2 changes: 1 addition & 1 deletion packages/playback-core/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
if (duration && time > duration) {
time = duration;
}
for (let i = 0; i < seekable.length ?? 0; i++) {
for (let i = 0; i < seekable.length; i++) {

Check warning on line 44 in packages/playback-core/src/util.ts

View check run for this annotation

Codecov / codecov/patch

packages/playback-core/src/util.ts#L44

Added line #L44 was not covered by tests
if (seekable.start(i) <= time && seekable.end(i) >= time) {
return true;
}
Expand Down
5 changes: 2 additions & 3 deletions scripts/esbuilder/esbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ if (esmScriptModule) {
options.format = 'esm';
}

await esbuild.build(options);

if (args.watch) {
const context = await esbuild.context(options);
await context.rebuild();
await context.watch();
} else {
await esbuild.build(options);
}
80 changes: 40 additions & 40 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14687,47 +14687,47 @@ tunnel-agent@^0.6.0:
dependencies:
safe-buffer "^5.0.1"

[email protected].0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.11.0.tgz#a3c62e833b83ae769c13e8b1f0814d3b111c471e"
integrity sha512-yLDeJ7QgpI1Niw87ydRNvygX67Dra+6MnxR88vwXnQJKsmHTKycBhY9w3Bhe5xvnIg4JoEWoEF5EJtw6ShrlEw==

[email protected].0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.11.0.tgz#29ace24b724fce44422c7d447337779cbb50ca15"
integrity sha512-lZGlfTG6+u3R7+6eVY9j/07WpVF/tx8UNkmRWfMNt4ZGSEBMg6A+Vimvp+rni92WdPhD/rhxv+qYI/kco9hNXg==

[email protected].0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.11.0.tgz#bc7b78924ddae107a2066004aace925f1f8ddfbe"
integrity sha512-I88/WieHzTZ8V2y0j79RSjVERPp0IJTynTwLi7ddYX0PahkuyaHs1p8ktFMcs6awnJMeT6spaXlyzv5ZxnAdkg==

[email protected].0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.11.0.tgz#13be0290136b83540eeaf1704dc6dc3a22c50cf9"
integrity sha512-jHsKuTFa7KwrA/FIxOnyXnfSEgDEUv0UVcseqQhP0VbdL+En93ZdBZ9S9/lI6VWooXrCqPooBmC+M/6jmwY/Ig==

[email protected].0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.11.0.tgz#750f1cf49fa6e235c7a5fca17224aaad453131e7"
integrity sha512-7u/1GoMallGDOTg4fnKoJmvBkf2pUCOcA0Z7NbwFB6GOa7q1Su4AaPs6Iy6Tyqrmj3vDHKSXByHwfz+o0cng/g==

[email protected].0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.11.0.tgz#7e18c948cfabf695a089aa376e202e4241b2d897"
integrity sha512-39MNaZ7RnbINEnpeAfB++fmH6p99RhbeeC8n2IXqG61Zrck5AA59Jm8DXpfOGR6Im93iHXSDox8qF3bb8V4amQ==

turbo@^1.11.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.11.0.tgz#8212cd50f89858ecbc69f3fee5d1b68e0b64a6bf"
integrity sha512-zIqJs/x1zzIIdwufhk80o7cQc9fIdHdweWRNXbK+Vjf9IaM2eSslcYyo40s+Kg/oiIOpdLM8hV7IUQst8KIyDA==
[email protected].2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.11.2.tgz#fc3d4d74b325a27aef11b6a52a61f07d466846b9"
integrity sha512-toFmRG/adriZY3hOps7nYCfqHAS+Ci6xqgX3fbo82kkLpC6OBzcXnleSwuPqjHVAaRNhVoB83L5njcE9Qwi2og==

[email protected].2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.11.2.tgz#583a4d0025bc3f953a9eeb7065cb173f481a9965"
integrity sha512-FCsEDZ8BUSFYEOSC3rrARQrj7x2VOrmVcfrMUIhexTxproRh4QyMxLfr6LALk4ymx6jbDCxWa6Szal8ckldFbA==

[email protected].2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.11.2.tgz#55ef996d856cb397b9fb2855a554ccef1cee9dd7"
integrity sha512-Vzda/o/QyEske5CxLf0wcu7UUS+7zB90GgHZV4tyN+WZtoouTvbwuvZ3V6b5Wgd3OJ/JwWR0CXDK7Sf4VEMr7A==

[email protected].2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.11.2.tgz#64d6093c9a2f32f410624564fd10685c847d947e"
integrity sha512-bRLwovQRz0yxDZrM4tQEAYV0fBHEaTzUF0JZ8RG1UmZt/CqtpnUrJpYb1VK8hj1z46z9YehARpYCwQ2K0qU4yw==

[email protected].2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.11.2.tgz#f4164be9c42796c86ca3929e27f1992a4310b9ed"
integrity sha512-LgTWqkHAKgyVuLYcEPxZVGPInTjjeCnN5KQMdJ4uQZ+xMDROvMFS2rM93iQl4ieDJgidwHCxxCxaU9u8c3d/Kg==

[email protected].2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.11.2.tgz#ca1b4d7ac6fe8c931baef1a270ac07bbd924277b"
integrity sha512-829aVBU7IX0c/B4G7g1VI8KniAGutHhIupkYMgF6xPkYVev2G3MYe6DMS/vsLt9GGM9ulDtdWxWrH5P2ngK8IQ==

turbo@^1.11.2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.11.2.tgz#7bae6df12c210e9b12973aad8f0e7b077039d4ce"
integrity sha512-jPC7LVQJzebs5gWf8FmEvsvXGNyKbN+O9qpvv98xpNaM59aS0/Irhd0H0KbcqnXfsz7ETlzOC3R+xFWthC4Z8A==
optionalDependencies:
turbo-darwin-64 "1.11.0"
turbo-darwin-arm64 "1.11.0"
turbo-linux-64 "1.11.0"
turbo-linux-arm64 "1.11.0"
turbo-windows-64 "1.11.0"
turbo-windows-arm64 "1.11.0"
turbo-darwin-64 "1.11.2"
turbo-darwin-arm64 "1.11.2"
turbo-linux-64 "1.11.2"
turbo-linux-arm64 "1.11.2"
turbo-windows-64 "1.11.2"
turbo-windows-arm64 "1.11.2"

tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
Expand Down
Loading