@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.
- package/package.json +1 -1
- package/scripts/video.js +13 -9
package/package.json
CHANGED
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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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,
|