Skip to content

Commit 3e754f8

Browse files
mgurgelgithub-actions[bot]
authored andcommitted
Release build 9.9.0 [ci release]
1 parent 8af2080 commit 3e754f8

File tree

13 files changed

+497
-73
lines changed

13 files changed

+497
-73
lines changed

CHANGELOG.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
- Fix config schema tests (#1752)
2-
- onboarding: updated assets and copy (#1718)
3-
- fix: NTP Privacy Stats widget number formatting (#1735)
4-
- build(deps-dev): bump the typescript group across 1 directory with 2 updates (#1743)
1+
- Duck Player: Add support for new YouTube Player UI links (#1753)

Sources/ContentScopeScripts/dist/pages/duckplayer/dist/index.js

Lines changed: 79 additions & 11 deletions
Large diffs are not rendered by default.

Sources/ContentScopeScripts/dist/pages/duckplayer/index.html

Lines changed: 79 additions & 11 deletions
Large diffs are not rendered by default.

build/android/pages/duckplayer/dist/index.js

Lines changed: 79 additions & 11 deletions
Large diffs are not rendered by default.

build/integration/pages/duckplayer/dist/index.js

Lines changed: 79 additions & 11 deletions
Large diffs are not rendered by default.

build/windows/pages/duckplayer/dist/index.js

Lines changed: 79 additions & 11 deletions
Large diffs are not rendered by default.

special-pages/pages/duckplayer/app/components/Components.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function Components() {
2222
platform: { name: 'macos' },
2323
customError: { state: 'enabled' },
2424
});
25-
let embed = EmbedSettings.fromHref('https://localhost?videoID=123');
25+
let embed = /** @type {EmbedSettings} */ (EmbedSettings.fromHref('https://localhost?videoID=123'));
2626
let url = embed?.toEmbedUrl();
2727
if (!url) throw new Error('unreachable');
2828
return (
@@ -76,7 +76,7 @@ export function Components() {
7676
</h2>
7777
<SettingsProvider settings={settings}>
7878
<PlayerContainer>
79-
<Player src={url} layout={'desktop'} />
79+
<Player src={url} layout={'desktop'} embed={embed} />
8080
<InfoBarContainer>
8181
<InfoBar embed={embed} />
8282
</InfoBarContainer>

special-pages/pages/duckplayer/app/components/DesktopApp.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function DesktopLayout({ embed }) {
4040
<PlayerContainer>
4141
{embed === null && <PlayerError layout={'desktop'} kind={'invalid-id'} />}
4242
{embed !== null && showCustomError && <YouTubeError layout={'desktop'} embed={embed} />}
43-
{embed !== null && !showCustomError && <Player src={embed.toEmbedUrl()} layout={'desktop'} />}
43+
{embed !== null && !showCustomError && <Player src={embed.toEmbedUrl()} layout={'desktop'} embed={embed} />}
4444
<HideInFocusMode style={'slide'}>
4545
<InfoBarContainer>
4646
<InfoBar embed={embed} />

special-pages/pages/duckplayer/app/components/MobileApp.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export function MobileApp({ embed }) {
2424
const settings = useSettings();
2525
const telemetry = useTelemetry();
2626
const showCustomError = useShowCustomError();
27-
2827
const features = createAppFeaturesFrom(settings);
28+
2929
return (
3030
<>
3131
{!showCustomError && features.focusMode()}
@@ -65,7 +65,7 @@ function MobileLayout({ embed }) {
6565
<div class={styles.embed}>
6666
{embed === null && <PlayerError layout={'mobile'} kind={'invalid-id'} />}
6767
{embed !== null && showCustomError && <YouTubeError layout={'mobile'} embed={embed} />}
68-
{embed !== null && !showCustomError && <Player src={embed.toEmbedUrl()} layout={'mobile'} />}
68+
{embed !== null && !showCustomError && <Player src={embed.toEmbedUrl()} layout={'mobile'} embed={embed} />}
6969
</div>
7070
<div class={cn(styles.logo, styles.hideInFocus)}>
7171
<MobileWordmark />

special-pages/pages/duckplayer/app/components/Player.jsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@ import { h } from 'preact';
22
import cn from 'classnames';
33
import styles from './Player.module.css';
44
import { useEffect, useRef } from 'preact/hooks';
5-
import { useSettings } from '../providers/SettingsProvider.jsx';
5+
import { useSettings, useOpenOnYoutubeHandler } from '../providers/SettingsProvider.jsx';
66
import { createIframeFeatures } from '../features/iframe.js';
77
import { Settings } from '../settings';
88
import { useTypedTranslation } from '../types.js';
99

10+
/**
11+
* @import {EmbedSettings} from '../embed-settings.js';
12+
*/
13+
1014
/**
1115
* Player component renders an embedded media player.
1216
*
1317
* @param {object} props
1418
* @param {string} props.src - The source URL of the media to be played.
1519
* @param {Settings['layout']} props.layout
20+
* @param {EmbedSettings} props.embed
1621
*/
17-
export function Player({ src, layout }) {
18-
const { ref, didLoad } = useIframeEffects(src);
22+
export function Player({ src, layout, embed }) {
23+
const { ref, didLoad } = useIframeEffects(src, embed);
1924
const wrapperClasses = cn({
2025
[styles.root]: true,
2126
[styles.player]: true,
@@ -80,20 +85,22 @@ export function PlayerError({ kind, layout }) {
8085
* When either event occurs, we proceed to apply our list of features.
8186
*
8287
* @param {string} src - the iframe `src` attribute
88+
* @param {EmbedSettings} embed
8389
* @return {{
8490
* ref: import("preact/hooks").MutableRef<HTMLIFrameElement|null>,
8591
* didLoad: () => void
8692
* }}
8793
*/
88-
function useIframeEffects(src) {
94+
function useIframeEffects(src, embed) {
8995
const ref = useRef(/** @type {HTMLIFrameElement|null} */ (null));
9096
const didLoad = useRef(/** @type {boolean} */ (false));
9197
const settings = useSettings();
98+
const openOnYoutube = useOpenOnYoutubeHandler();
9299

93100
useEffect(() => {
94101
if (!ref.current) return;
95102
const iframe = ref.current;
96-
const features = createIframeFeatures(settings);
103+
const features = createIframeFeatures(settings, embed);
97104

98105
/** @type {import("../features/iframe.js").IframeFeature[]} */
99106
const iframeFeatures = [
@@ -103,6 +110,7 @@ function useIframeEffects(src) {
103110
features.titleCapture(),
104111
features.mouseCapture(),
105112
features.errorDetection(),
113+
features.replaceWatchLinks(() => openOnYoutube(embed)),
106114
];
107115

108116
/**
@@ -131,7 +139,7 @@ function useIframeEffects(src) {
131139
}
132140
iframe.removeEventListener('load', loadHandler);
133141
};
134-
}, [src, settings]);
142+
}, [src, settings, embed]);
135143

136144
return { ref, didLoad: () => (didLoad.current = true) };
137145
}

0 commit comments

Comments
 (0)