1
+ /* generated by Svelte vX.Y.Z */
2
+ import {
3
+ SvelteComponent ,
4
+ add_render_callback ,
5
+ add_resize_listener ,
6
+ detach ,
7
+ element ,
8
+ init ,
9
+ insert ,
10
+ listen ,
11
+ noop ,
12
+ raf ,
13
+ run_all ,
14
+ safe_not_equal
15
+ } from "svelte/internal" ;
16
+
17
+ function create_fragment ( ctx ) {
18
+ let video ;
19
+ let video_updating = false ;
20
+ let video_resize_listener ;
21
+ let video_animationframe ;
22
+ let dispose ;
23
+
24
+ function video_timeupdate_handler ( ) {
25
+ cancelAnimationFrame ( video_animationframe ) ;
26
+
27
+ if ( ! video . paused ) {
28
+ video_animationframe = raf ( video_timeupdate_handler ) ;
29
+ video_updating = true ;
30
+ }
31
+
32
+ ctx . video_timeupdate_handler . call ( video ) ;
33
+ }
34
+
35
+ return {
36
+ c ( ) {
37
+ video = element ( "video" ) ;
38
+ add_render_callback ( ( ) => ctx . video_elementresize_handler . call ( video ) ) ;
39
+ if ( ctx . videoHeight === void 0 || ctx . videoWidth === void 0 ) add_render_callback ( ( ) => ctx . video_resize_handler . call ( video ) ) ;
40
+
41
+ dispose = [
42
+ listen ( video , "timeupdate" , video_timeupdate_handler ) ,
43
+ listen ( video , "resize" , ctx . video_resize_handler )
44
+ ] ;
45
+ } ,
46
+ m ( target , anchor ) {
47
+ insert ( target , video , anchor ) ;
48
+ video_resize_listener = add_resize_listener ( video , ctx . video_elementresize_handler . bind ( video ) ) ;
49
+ } ,
50
+ p ( changed , ctx ) {
51
+ if ( ! video_updating && changed . currentTime && ! isNaN ( ctx . currentTime ) ) {
52
+ video . currentTime = ctx . currentTime ;
53
+ }
54
+
55
+ video_updating = false ;
56
+ } ,
57
+ i : noop ,
58
+ o : noop ,
59
+ d ( detaching ) {
60
+ if ( detaching ) detach ( video ) ;
61
+ video_resize_listener . cancel ( ) ;
62
+ run_all ( dispose ) ;
63
+ }
64
+ } ;
65
+ }
66
+
67
+ function instance ( $$self , $$props , $$invalidate ) {
68
+ let { currentTime } = $$props ;
69
+ let { videoHeight } = $$props ;
70
+ let { videoWidth } = $$props ;
71
+ let { offsetWidth } = $$props ;
72
+
73
+ function video_elementresize_handler ( ) {
74
+ offsetWidth = this . offsetWidth ;
75
+ $$invalidate ( "offsetWidth" , offsetWidth ) ;
76
+ }
77
+
78
+ function video_timeupdate_handler ( ) {
79
+ currentTime = this . currentTime ;
80
+ $$invalidate ( "currentTime" , currentTime ) ;
81
+ }
82
+
83
+ function video_resize_handler ( ) {
84
+ videoHeight = this . videoHeight ;
85
+ videoWidth = this . videoWidth ;
86
+ $$invalidate ( "videoHeight" , videoHeight ) ;
87
+ $$invalidate ( "videoWidth" , videoWidth ) ;
88
+ }
89
+
90
+ $$self . $set = $$props => {
91
+ if ( "currentTime" in $$props ) $$invalidate ( "currentTime" , currentTime = $$props . currentTime ) ;
92
+ if ( "videoHeight" in $$props ) $$invalidate ( "videoHeight" , videoHeight = $$props . videoHeight ) ;
93
+ if ( "videoWidth" in $$props ) $$invalidate ( "videoWidth" , videoWidth = $$props . videoWidth ) ;
94
+ if ( "offsetWidth" in $$props ) $$invalidate ( "offsetWidth" , offsetWidth = $$props . offsetWidth ) ;
95
+ } ;
96
+
97
+ return {
98
+ currentTime,
99
+ videoHeight,
100
+ videoWidth,
101
+ offsetWidth,
102
+ video_elementresize_handler,
103
+ video_timeupdate_handler,
104
+ video_resize_handler
105
+ } ;
106
+ }
107
+
108
+ class Component extends SvelteComponent {
109
+ constructor ( options ) {
110
+ super ( ) ;
111
+
112
+ init ( this , options , instance , create_fragment , safe_not_equal , {
113
+ currentTime : 0 ,
114
+ videoHeight : 0 ,
115
+ videoWidth : 0 ,
116
+ offsetWidth : 0
117
+ } ) ;
118
+ }
119
+ }
120
+
121
+ export default Component ;
0 commit comments