Skip to content

Commit

Permalink
Remove shaka-player dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme authored and ceyhun committed Apr 7, 2020
1 parent 148b617 commit 5c6697a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
22 changes: 4 additions & 18 deletions dom/RCTVideo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @flow

import { RCTEvent, RCTView, type RCTBridge } from "react-native-dom";
import shaka from "shaka-player";

import resizeModes from "./resizeModes";
import type { VideoSource } from "./types";
Expand All @@ -26,8 +25,6 @@ class RCTVideo extends RCTView {

this.eventDispatcher = bridge.getModuleByName("EventDispatcher");

shaka.polyfill.installAll();

this.onEnd = this.onEnd.bind(this);
this.onLoad = this.onLoad.bind(this);
this.onLoadStart = this.onLoadStart.bind(this);
Expand All @@ -41,7 +38,6 @@ class RCTVideo extends RCTView {
this.videoElement.addEventListener("loadstart", this.onLoadStart);
this.videoElement.addEventListener("pause", this.onPause);
this.videoElement.addEventListener("play", this.onPlay);
this.player = new shaka.Player(this.videoElement);

this.muted = false;
this.rate = 1.0;
Expand Down Expand Up @@ -154,19 +150,9 @@ class RCTVideo extends RCTView {
uri = URL.createObjectURL(blob);
}

if (!shaka.Player.isBrowserSupported()) { // primarily iOS WebKit
this.videoElement.setAttribute("src", uri);
if (!this._paused) {
this.requestPlay();
}
} else {
this.player.load(uri)
.then(() => {
if (!this._paused) {
this.requestPlay();
}
})
.catch(this.onError);
this.videoElement.setAttribute("src", uri);
if (!this._paused) {
this.requestPlay();
}
}

Expand All @@ -182,7 +168,7 @@ class RCTVideo extends RCTView {
onEnd = () => {
this.onProgress();
this.sendEvent("topVideoEnd", null);
this.stopProgressTimer();
this.stopProgressTimer();
}

onError = error => {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
"react-native": "^0.57.8"
},
"dependencies": {
"prop-types": "^15.5.10",
"shaka-player": "^2.4.4"
"prop-types": "^15.5.10"
},
"scripts": {
"test": "node_modules/.bin/eslint *.js"
Expand Down

0 comments on commit 5c6697a

Please sign in to comment.