@crispcode/shimmer 5.1.0 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/video.js +13 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crispcode/shimmer",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "A PIXI.JS wrapper plugin for MODUX",
5
5
  "author": "Crisp Code ( contact@crispcode.ro )",
6
6
  "access": "public",
package/scripts/video.js CHANGED
@@ -9,6 +9,8 @@ import { Element } from './element.js'
9
9
 
10
10
  /**
11
11
  * This class is used to create video elements for shimmer
12
+ * @param {Video|String} video The source Video element or url
13
+ * @param {Object} options The options for the video
12
14
  */
13
15
  export class Video extends Element {
14
16
  /**
@@ -17,15 +19,17 @@ export class Video extends Element {
17
19
  constructor ( source, options = {} ) {
18
20
  super()
19
21
 
20
- this.__source = document.createElement( 'video' )
21
- this.__source.playsInline = true
22
- this.__source.preload = 'auto'
23
- this.__source.autoplay = false
24
- this.__source.playbackRate = ( options.playbackRate !== undefined ) ? options.playbackRate : 1
25
- this.__source.muted = ( options.muted !== undefined ) ? options.muted : false
26
-
27
- this.__source.loop = ( options.loop !== undefined ) ? options.loop : true
28
- this.__source.src = source
22
+ if ( typeof source === Video ) {
23
+ this.__source = document.createElement( 'video' )
24
+ this.__source.playsInline = true
25
+ this.__source.preload = 'auto'
26
+ this.__source.autoplay = false
27
+ this.__source.muted = ( options.muted !== undefined ) ? options.muted : false
28
+ this.__source.loop = ( options.loop !== undefined ) ? options.loop : true
29
+ this.__source.src = source
30
+ } else {
31
+ this.__source = source
32
+ }
29
33
 
30
34
  this.__resource = new VideoResource( this.__source, {
31
35
  autoPlay: ( options.autoPlay !== undefined ) ? options.autoPlay : false,