Skip to content

Commit

Permalink
Pass origin to YT Player API (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Kennedy committed Jul 11, 2020
1 parent af08b31 commit 83d3972
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/youtube-video.ts
Expand Up @@ -82,6 +82,7 @@ export class YoutubeVideoElement extends HTMLElement {
srcQueryParams.autoplay = this.autoplay ? 1 : 0;
srcQueryParams.controls = this.controls ? 1 : 0;
srcQueryParams.playsinline = this.playsinline ? 1 : 0;
srcQueryParams.origin = window.location.origin;
return srcQueryParams;
}

Expand Down
4 changes: 4 additions & 0 deletions tests/youtube-video-tests.ts
Expand Up @@ -303,6 +303,10 @@ describe('Youtube Video Tests', function () {
var [, ytPlayerConstructorOptions] = fakePlayerConstructor.args[0];
assert.equal(ytPlayerConstructorOptions.playerVars.v, params.v);
assert.equal(ytPlayerConstructorOptions.playerVars.my, params.my);
assert.equal(
ytPlayerConstructorOptions.playerVars.origin,
window.location.origin
);
});

it('attempting to play/pause a video before player has loaded does not throw an mediaError', async function () {
Expand Down

0 comments on commit 83d3972

Please sign in to comment.