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

Completely remove RxJS dependency from the RxPlayer's source code. #1193

Merged
merged 8 commits into from
Dec 27, 2022
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
12 changes: 8 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@
"url": "git://github.com/canalplus/rx-player.git"
},
"dependencies": {
"next-tick": "1.1.0",
"rxjs": "7.5.7"
"next-tick": "1.1.0"
},
"devDependencies": {
"@babel/core": "7.20.2",
Expand Down Expand Up @@ -122,6 +121,7 @@
"react-dom": "18.2.0",
"regenerator-runtime": "0.13.10",
"rimraf": "3.0.2",
"rxjs": "7.5.7",
"semver": "7.3.8",
"sinon": "14.0.2",
"terser-webpack-plugin": "5.3.6",
Expand Down
73 changes: 0 additions & 73 deletions src/compat/__tests__/play.test.ts

This file was deleted.

71 changes: 0 additions & 71 deletions src/compat/__tests__/set_element_src.test.ts

This file was deleted.

109 changes: 0 additions & 109 deletions src/compat/__tests__/when_loaded_metadata.test.ts

This file was deleted.

29 changes: 14 additions & 15 deletions src/compat/eme/custom_media_keys/ie11_media_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
* limitations under the License.
*/

import {
merge as observableMerge,
Subject,
takeUntil,
} from "rxjs";
import EventEmitter from "../../../utils/event_emitter";
import TaskCanceller from "../../../utils/task_canceller";
import { ICompatHTMLMediaElement } from "../../browser_compatibility_types";
import * as events from "../../event_listeners";
import {
Expand All @@ -43,16 +39,16 @@ class IE11MediaKeySession
public expiration: number;
public keyStatuses: ICustomMediaKeyStatusMap;
private readonly _mk: MSMediaKeys;
private readonly _closeSession$: Subject<void>;
private readonly _sessionClosingCanceller: TaskCanceller;
private _ss: MSMediaKeySession | undefined;
constructor(mk: MSMediaKeys) {
super();
this.expiration = NaN;
this.keyStatuses = new Map();
this._mk = mk;
this._closeSession$ = new Subject();
this._sessionClosingCanceller = new TaskCanceller();
this.closed = new Promise((resolve) => {
this._closeSession$.subscribe(resolve);
this._sessionClosingCanceller.signal.register(() => resolve());
});
this.update = (license: Uint8Array) => {
return new Promise((resolve, reject) => {
Expand All @@ -79,11 +75,15 @@ class IE11MediaKeySession
initData instanceof ArrayBuffer ? new Uint8Array(initData) :
new Uint8Array(initData.buffer);
this._ss = this._mk.createSession("video/mp4", initDataU8);
observableMerge(events.onKeyMessage$(this._ss),
events.onKeyAdded$(this._ss),
events.onKeyError$(this._ss)
).pipe(takeUntil(this._closeSession$))
.subscribe((evt: Event) => this.trigger(evt.type, evt));
events.onKeyMessage(this._ss, (evt) => {
this.trigger((evt as Event).type ?? "message", evt as Event);
}, this._sessionClosingCanceller.signal);
events.onKeyAdded(this._ss, (evt) => {
this.trigger((evt as Event).type ?? "keyadded", evt as Event);
}, this._sessionClosingCanceller.signal);
events.onKeyError(this._ss, (evt) => {
this.trigger((evt as Event).type ?? "keyerror", evt as Event);
}, this._sessionClosingCanceller.signal);
resolve();
});
}
Expand All @@ -93,8 +93,7 @@ class IE11MediaKeySession
this._ss.close();
this._ss = undefined;
}
this._closeSession$.next();
this._closeSession$.complete();
this._sessionClosingCanceller.cancel();
resolve();
});
}
Expand Down
Loading