Skip to content

Commit

Permalink
use message to open duckplayer from overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Jul 8, 2024
1 parent bbcad33 commit 040aec4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
10 changes: 1 addition & 9 deletions integration-test/playwright/page-objects/duckplayer-overlays.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,8 @@ export class DuckplayerOverlays {
}

async watchInDuckPlayer () {
const failure = new Promise(resolve => {
this.page.context().on('requestfailed', f => {
if (f.url().startsWith('duck')) resolve(f.url())
})
})

await this.page.getByRole('link', { name: 'Watch in Duck Player' }).click()

// assert the page tried to navigate to duck player
expect(await failure).toEqual('duck://player/123')
await this.duckPlayerLoadsFor('123')
}

async watchHere () {
Expand Down
4 changes: 3 additions & 1 deletion src/features/duckplayer/video-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ export class VideoOverlay {
* But, if the checkbox was not checked, then we want to keep the state
* as 'alwaysAsk'
*
* @param {boolean} remember
* @param {VideoParams} params
*/
userOptIn (remember, params) {
/** @type {import("../duck-player.js").UserValues['privatePlayerMode']} */
Expand All @@ -285,7 +287,7 @@ export class VideoOverlay {
privatePlayerMode
}
this.messages.setUserValues(outgoing)
.then(() => this.environment.setHref(params.toPrivatePlayerUrl()))
.then(() => this.messages.openDuckPlayer({ href: params.toPrivatePlayerUrl() }))
.catch(e => console.error('error setting user choice', e))
}

Expand Down

0 comments on commit 040aec4

Please sign in to comment.