Various cleanups

This commit is contained in:
Hampton Maxwell 2018-09-28 17:07:38 -07:00 committed by Hampton Maxwell
parent 8bda6546e8
commit 1be0db4777

View File

@ -41,6 +41,7 @@ class RCTVideo extends RCTView {
this.muted = false; this.muted = false;
this.rate = 1.0; this.rate = 1.0;
this.volume = 1.0; this.volume = 1.0;
this.videoElement.autoplay = true;
this.childContainer.appendChild(this.videoElement); this.childContainer.appendChild(this.videoElement);
} }
@ -97,7 +98,7 @@ class RCTVideo extends RCTView {
if (value) { if (value) {
this.videoElement.pause(); this.videoElement.pause();
} else { } else {
this.playPromise = this.videoElement.play().catch(console.error); this.playPromise = this.videoElement.play();
} }
}); });
this._paused = value; this._paused = value;
@ -106,8 +107,10 @@ class RCTVideo extends RCTView {
set progressUpdateInterval(value: number) { set progressUpdateInterval(value: number) {
this._progressUpdateInterval = value; this._progressUpdateInterval = value;
this.stopProgressTimer(); this.stopProgressTimer();
if (!this._paused) {
this.startProgressTimer(); this.startProgressTimer();
} }
}
set rate(value: number) { set rate(value: number) {
this.videoElement.defaultPlaybackRate = value; // playbackRate doesn't work on Chrome this.videoElement.defaultPlaybackRate = value; // playbackRate doesn't work on Chrome