-
Notifications
You must be signed in to change notification settings - Fork 437
fix: remove global and use 'videojs-global-compat' #1595
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| import document from 'global/document'; | ||||||
| import document from 'videojs-global-compat/document'; | ||||||
| import videojs from 'video.js'; | ||||||
| import Events from 'video.js'; | ||||||
| import QUnit from 'qunit'; | ||||||
|
|
@@ -41,7 +41,7 @@ import { | |||||
| getAllPsshKeySystemsOptions, | ||||||
| waitForKeySessionCreation | ||||||
| } from '../src/videojs-http-streaming'; | ||||||
| import window from 'global/window'; | ||||||
| import window from 'videojs-global-compat/window'; | ||||||
| // we need this so the plugin registers itself | ||||||
| import 'videojs-contrib-quality-levels'; | ||||||
| import 'videojs-contrib-eme'; | ||||||
|
|
@@ -4163,7 +4163,7 @@ QUnit.test('Allows overriding the global beforeRequest function', function(asser | |||||
|
|
||||||
| assert.equal(beforeLocalRequestCalled, 2, 'local beforeRequest was called twice ' + | ||||||
| 'for the media playlist and media'); | ||||||
| assert.equal(beforeGlobalRequestCalled, 1, 'global beforeRequest was called once ' + | ||||||
| assert.equal(beforeGlobalRequestCalled, 1, 'videojs-global-compat beforeRequest was called once ' + | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| 'for the main playlist'); | ||||||
| assert.equal(this.env.log.warn.calls, 3, 'warning logged for deprecation'); | ||||||
|
|
||||||
|
|
@@ -4305,7 +4305,7 @@ QUnit.test('Allows setting onRequest hooks globally and overriding with player h | |||||
| this.player.tech_.vhs.xhr.offRequest(playerRequestHook2); | ||||||
|
|
||||||
| assert.equal(onRequestHookCallCountGlobal, 0, 'no onRequest global hooks called'); | ||||||
| assert.equal(actualRequestUrlGlobal, undefined, 'global request url undefined'); | ||||||
| assert.equal(actualRequestUrlGlobal, undefined, 'videojs-global-compat request url undefined'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| assert.equal(onRequestHookCallCountPlayer, 2, '2 onRequest player hooks called'); | ||||||
| assert.equal(actualRequestUrlPlayer, 'http://localhost:9999/test/media2.m3u8?bar=foo', 'request url modified by player onRequest hook'); | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| import window from 'global/window'; | ||||||
| import window from 'videojs-global-compat/window'; | ||||||
| import QUnit from 'qunit'; | ||||||
| import {default as xhrFactory, byterangeStr} from '../src/xhr'; | ||||||
| import { useFakeEnvironment } from './test-helpers.js'; | ||||||
|
|
@@ -47,7 +47,7 @@ QUnit.test('xhr respects beforeRequest', function(assert) { | |||||
| delete this.xhr.beforeRequest; | ||||||
|
|
||||||
| this.xhr(defaultOptions); | ||||||
| assert.equal(this.requests.shift().url, 'global', 'url changed with global override'); | ||||||
| assert.equal(this.requests.shift().url, 'videojs-global-compat', 'url changed with global override'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| assert.equal(this.env.log.warn.calls, 1, 'warning logged for deprecation'); | ||||||
|
|
||||||
| delete videojs.Vhs.xhr.beforeRequest; | ||||||
|
|
@@ -62,11 +62,11 @@ QUnit.test('beforeRequest can return a new options object', function(assert) { | |||||
| assert.equal(this.requests.shift().url, 'default', 'url the same without override'); | ||||||
|
|
||||||
| videojs.Vhs.xhr.beforeRequest = () => { | ||||||
| return { uri: 'global-newOptions'}; | ||||||
| return { uri: 'videojs-global-compat-newOptions'}; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }; | ||||||
|
|
||||||
| this.xhr(defaultOptions); | ||||||
| assert.equal(this.requests.shift().url, 'global-newOptions', 'url changed with global override'); | ||||||
| assert.equal(this.requests.shift().url, 'videojs-global-compat-newOptions', 'url changed with global override'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| assert.equal(this.env.log.warn.calls, 1, 'warning logged for deprecation'); | ||||||
|
|
||||||
| this.xhr.beforeRequest = () => { | ||||||
|
|
@@ -112,7 +112,7 @@ QUnit.test('calls global and player onRequest hooks respectively', function(asse | |||||
| this.xhr(defaultOptions); | ||||||
| xhrRequest = this.requests.shift(); | ||||||
|
|
||||||
| assert.equal(xhrRequest.url, 'global', 'url changed with global onRequest hooks'); | ||||||
| assert.equal(xhrRequest.url, 'videojs-global-compat', 'url changed with global onRequest hooks'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| assert.equal(xhrRequest.headers.foo, 'bar', 'headers changed with global onRequest hooks'); | ||||||
|
|
||||||
| // create the player onRequest set and 2 hooks | ||||||
|
|
@@ -143,7 +143,7 @@ QUnit.test('calls global and player onRequest hooks respectively', function(asse | |||||
| delete this.xhr._requestCallbackSet; | ||||||
| this.xhr(defaultOptions); | ||||||
| xhrRequest = this.requests.shift(); | ||||||
| assert.equal(xhrRequest.url, 'global', 'url changed with player onRequest hooks'); | ||||||
| assert.equal(xhrRequest.url, 'videojs-global-compat', 'url changed with player onRequest hooks'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| assert.equal(xhrRequest.headers.foo, 'bar', 'headers changed with player onRequest hooks'); | ||||||
|
|
||||||
| delete videojs.Vhs.xhr._requestCallbackSet; | ||||||
|
|
@@ -180,7 +180,7 @@ QUnit.test('xhr calls global and player onResponse hooks respectively', function | |||||
| const playerOnResponseHook2 = (request, error, response) => { | ||||||
| assert.equal(response.headers.foo, 'bar', 'expected headers'); | ||||||
| assert.equal(response.statusCode, 200, 'expected statusCode'); | ||||||
| assert.equal(globalHookCallCount, 0, 'global response hooks not called yet'); | ||||||
| assert.equal(globalHookCallCount, 0, 'videojs-global-compat response hooks not called yet'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| done(); | ||||||
| }; | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repo and package probably ought to be in the video.js GitHub and NPM orgs.