react-video-renderer
Advanced tools
Comparing version 2.1.2 to 2.2.1
@@ -30,2 +30,3 @@ /// <reference types="react" /> | ||
export interface VideoProps { | ||
sourceType?: 'video' | 'audio'; | ||
src: string; | ||
@@ -48,3 +49,3 @@ children: RenderCallback; | ||
export declare class Video extends Component<VideoProps, VideoComponentState> { | ||
videoElement: HTMLVideoElement; | ||
videoElement: HTMLVideoElement | HTMLAudioElement; | ||
state: VideoComponentState; | ||
@@ -69,3 +70,3 @@ constructor(props: VideoProps); | ||
readonly actions: VideoActions; | ||
saveVideoRef: (element: HTMLVideoElement) => void; | ||
savePlayableMediaRef: (element: any) => void; | ||
onDurationChange: (e: any) => void; | ||
@@ -72,0 +73,0 @@ onError: (e: any) => void; |
@@ -73,3 +73,2 @@ "use strict"; | ||
_this.onPause = function (e) { | ||
var video = e.target; | ||
_this.setState({ | ||
@@ -94,3 +93,6 @@ status: 'paused' | ||
_this.requestFullscreen = function () { | ||
utils_1.requestFullScreen(_this.videoElement); | ||
var sourceType = _this.props.sourceType; | ||
if (sourceType === 'video') { | ||
utils_1.requestFullScreen(_this.videoElement); | ||
} | ||
}; | ||
@@ -112,3 +114,3 @@ _this.mute = function () { | ||
}; | ||
_this.saveVideoRef = function (element) { | ||
_this.savePlayableMediaRef = function (element) { | ||
if (!element) { | ||
@@ -136,3 +138,4 @@ return; | ||
}; | ||
_this.videoElement = document.createElement('video'); | ||
var sourceType = props.sourceType; | ||
_this.videoElement = document.createElement(sourceType || 'video'); | ||
return _this; | ||
@@ -187,6 +190,8 @@ } | ||
var _a = this, videoState = _a.videoState, actions = _a.actions; | ||
var _b = this.props, src = _b.src, children = _b.children, autoPlay = _b.autoPlay, controls = _b.controls, preload = _b.preload; | ||
return children(React.createElement("video", { ref: this.saveVideoRef, src: src, preload: preload, controls: controls, autoPlay: autoPlay, onPlay: this.onPlay, onPause: this.onPause, onVolumeChange: this.onVolumeChange, onTimeUpdate: this.onTimeUpdate, onCanPlay: this.onCanPlay, onDurationChange: this.onDurationChange, onError: this.onError, onWaiting: this.onWaiting }), videoState, actions); | ||
var _b = this.props, sourceType = _b.sourceType, src = _b.src, children = _b.children, autoPlay = _b.autoPlay, controls = _b.controls, preload = _b.preload; | ||
var TagName = sourceType || 'video'; | ||
return children(React.createElement(TagName, { ref: this.savePlayableMediaRef, src: src, preload: preload, controls: controls, autoPlay: autoPlay, onPlay: this.onPlay, onPause: this.onPause, onVolumeChange: this.onVolumeChange, onTimeUpdate: this.onTimeUpdate, onCanPlay: this.onCanPlay, onDurationChange: this.onDurationChange, onError: this.onError, onWaiting: this.onWaiting }), videoState, actions); | ||
}; | ||
Video.defaultProps = { | ||
sourceType: 'video', | ||
autoPlay: false, | ||
@@ -193,0 +198,0 @@ controls: false, |
{ | ||
"name": "react-video-renderer", | ||
"version": "2.1.2", | ||
"version": "2.2.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:zzarcon/react-video-renderer.git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15868
290