Skip to content

Commit

Permalink
Merge pull request #6 from wordpress-mobile/issue/remove-apache2-depe…
Browse files Browse the repository at this point in the history
…ndencies

Remove apache2 dependencies
  • Loading branch information
ceyhun authored Apr 22, 2020
2 parents c43bdf6 + 5c6697a commit 6cdaddd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
12 changes: 5 additions & 7 deletions VideoResizeMode.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import keyMirror from 'keymirror';

export default keyMirror({
contain: null,
cover: null,
stretch: null,
});
export default {
contain: "contain",
cover: "cover",
stretch: "stretch",
};
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
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
"react-native": "^0.57.8"
},
"dependencies": {
"keymirror": "^0.1.1",
"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 6cdaddd

Please sign in to comment.