@@ -248,8 +248,8 @@ return /******/ (function(modules) { // webpackBootstrap
248
248
/* 3 */
249
249
/***/ function ( module , exports , __webpack_require__ ) {
250
250
251
- /** @jsx React.DOM */ var Jvent = __webpack_require__ ( 6 ) ,
252
- inherits = __webpack_require__ ( 7 ) ,
251
+ /** @jsx React.DOM */ var Jvent = __webpack_require__ ( 7 ) ,
252
+ inherits = __webpack_require__ ( 6 ) ,
253
253
Timer = __webpack_require__ ( 4 ) ,
254
254
Playlist = __webpack_require__ ( 5 ) ;
255
255
@@ -393,8 +393,6 @@ return /******/ (function(modules) { // webpackBootstrap
393
393
setStyles ( mediaEl , {
394
394
width : 'auto' ,
395
395
height : containerH + pad + 'px'
396
- // top: '0px',
397
- // left: (-(containerH * mediaAspect - containerW) / 2) + 'px'
398
396
} ) ;
399
397
}
400
398
@@ -420,8 +418,6 @@ return /******/ (function(modules) { // webpackBootstrap
420
418
setStyles ( mediaEl , {
421
419
width : containerW + 'px' ,
422
420
height : 'auto'
423
- // top: (-(containerW / mediaAspect - containerH) / 2) + 'px',
424
- // left: '0px'
425
421
} ) ;
426
422
}
427
423
}
@@ -464,6 +460,7 @@ return /******/ (function(modules) { // webpackBootstrap
464
460
this . emit ( 'media.loading' ) ;
465
461
466
462
mediaEl . src = src ;
463
+ mediaEl . preload = 'metadata' ;
467
464
468
465
if ( posterSrc ) {
469
466
mediaEl . poster = posterSrc ;
@@ -480,7 +477,7 @@ return /******/ (function(modules) { // webpackBootstrap
480
477
481
478
// Fallback to a slideshow.
482
479
this . slideshow = true ;
483
- this . createMediaEl ( ) ;
480
+ this . _createMediaEl ( ) ;
484
481
this . _playImageItem ( item , itemNum ) ;
485
482
486
483
} else {
@@ -559,6 +556,10 @@ return /******/ (function(modules) { // webpackBootstrap
559
556
mediaEl = this . mediaEl ;
560
557
561
558
function onLoadedMetadata ( data ) {
559
+ // Safari often stalls on first load, so kickstart it.
560
+ if ( mediaEl . networkState < 2 ) {
561
+ mediaEl . load ( ) ;
562
+ }
562
563
self . _setVideoData ( data ) ;
563
564
self . emit ( 'media.metadata' , data ) ;
564
565
}
@@ -573,19 +574,28 @@ return /******/ (function(modules) { // webpackBootstrap
573
574
574
575
function onProgress ( event ) {
575
576
// Sort of buggy, with readyState and buffer being inconsistent...
576
- var percent = 0 ,
577
- ready = event . target . readyState ,
578
- network = event . target . networkState ,
579
- buffered = event . target . buffered ,
580
- total = event . target . duration ;
577
+ var percent = null ,
578
+ video = event . target ;
581
579
582
- if ( network === 1 && ready === 0 ) {
583
- percent = 100 ;
580
+ // FF4+, Chrome
581
+ if ( video . buffered && video . buffered . length > 0 && video . buffered . end && video . duration ) {
582
+ percent = video . buffered . end ( 0 ) / video . duration ;
583
+ }
584
+
585
+ // Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
586
+ // to be anything other than 0. If the byte count is available we use this instead.
587
+ // Browsers that support the else if do not seem to have the bufferedBytes value and
588
+ // should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
589
+ else if ( typeof video . bytesTotal !== 'undefined' && video . bytesTotal > 0 && typeof video . bufferedBytes !== 'undefined' ) {
590
+ percent = video . bufferedBytes / video . bytesTotal ;
591
+ }
592
+
593
+ if ( percent !== null ) {
594
+ percent = 100 * Math . min ( 1 , Math . max ( 0 , percent ) ) ;
584
595
}
585
596
586
- if ( ready > 0 ) {
587
- var end = buffered . end ( 0 ) ;
588
- percent = ( end / total ) * 100 ;
597
+ if ( video . networkState === 1 && video . readyState === 0 ) {
598
+ percent = 100 ;
589
599
}
590
600
591
601
self . emit ( 'media.progress' , percent ) ;
@@ -594,13 +604,6 @@ return /******/ (function(modules) { // webpackBootstrap
594
604
function onEnded ( ) {
595
605
if ( ! self . _seeking ) {
596
606
self . emit ( 'media.ended' , self . currentItem ) ;
597
- if ( self . playlistLength > 1 && self . loop ) {
598
- var itemNum = 0 ;
599
- if ( self . currentItem + 1 < self . playlistLength ) {
600
- itemNum = self . currentItem + 1 ;
601
- }
602
- self . play ( itemNum ) ;
603
- }
604
607
}
605
608
}
606
609
@@ -649,23 +652,20 @@ return /******/ (function(modules) { // webpackBootstrap
649
652
650
653
function onEnded ( ) {
651
654
self . emit ( 'media.ended' , self . currentItem ) ;
652
- if ( self . playlistLength > 1 && self . loop ) {
653
- var itemNum = ( self . currentItem + 1 < self . playlistLength ) ? self . currentItem + 1 : 0 ;
654
- self . play ( itemNum ) ;
655
- }
656
655
}
657
656
658
657
this . _addListener ( mediaEl , 'load' , onLoad ) ;
659
658
this . _addListener ( mediaEl , 'ended' , onEnded ) ;
660
659
} ;
661
660
662
661
DriveIn . prototype . _attachListeners = function ( ) {
663
- var self = this ;
662
+ var self = this ,
663
+ mediaEl = this . mediaEl ;
664
664
665
665
function onResize ( ) {
666
666
window . requestAnimationFrame ( function ( ) {
667
667
if ( self . metadataLoaded ) {
668
- self . _updateSize ( self . mediaEl , self . currMediaType , self . mediaAspect ) ;
668
+ self . _updateSize ( mediaEl , self . currMediaType , self . mediaAspect ) ;
669
669
}
670
670
} ) ;
671
671
}
@@ -678,7 +678,18 @@ return /******/ (function(modules) { // webpackBootstrap
678
678
this . _attachImageListeners ( ) ;
679
679
}
680
680
681
+ this . on ( 'media.ended' , function ( ) {
682
+ if ( self . playlistLength > 1 && self . loop ) {
683
+ var itemNum = 0 ;
684
+ if ( self . currentItem + 1 < self . playlistLength ) {
685
+ itemNum = self . currentItem + 1 ;
686
+ }
687
+ self . play ( itemNum ) ;
688
+ }
689
+ } ) ;
690
+
681
691
this . on ( 'media.canplay' , function ( ) {
692
+ mediaEl . style . opacity = 1 ;
682
693
self . canplay = true ;
683
694
} ) ;
684
695
@@ -728,10 +739,12 @@ return /******/ (function(modules) { // webpackBootstrap
728
739
mediaEl = createEl ( 'video' , {
729
740
height : 1 ,
730
741
width : 1 ,
731
- preload : 'none '
742
+ preload : 'metadata '
732
743
} ) ;
733
744
}
734
745
746
+ mediaEl . style . opacity = 0 ;
747
+
735
748
this . mediaEl = mediaEl ;
736
749
this . currMediaType = mediaType ;
737
750
@@ -769,6 +782,8 @@ return /******/ (function(modules) { // webpackBootstrap
769
782
} ;
770
783
771
784
DriveIn . prototype . showPlaylist = function ( rawPlaylist , options ) {
785
+ options = options || { } ;
786
+
772
787
if ( options . hasOwnProperty ( 'mute' ) ) {
773
788
this . mute = options . mute ;
774
789
}
@@ -802,6 +817,14 @@ return /******/ (function(modules) { // webpackBootstrap
802
817
}
803
818
} ;
804
819
820
+ DriveIn . prototype . setPlaybackRate = function ( rate ) {
821
+ if ( this . currMediaType === 'image' ) {
822
+ return ;
823
+ }
824
+
825
+ this . mediaEl . playbackRate = rate || 1.0 ;
826
+ } ;
827
+
805
828
DriveIn . prototype . getMedia = function ( ) {
806
829
return this . mediaEl ;
807
830
} ;
@@ -855,14 +878,6 @@ return /******/ (function(modules) { // webpackBootstrap
855
878
}
856
879
} ;
857
880
858
- DriveIn . prototype . currentTime = function ( ) {
859
- if ( this . currMediaType === 'video' ) {
860
- return this . mediaEl . currentTime ;
861
- } else {
862
- return this . _slideshowTimer . currentTime ( ) ;
863
- }
864
- } ;
865
-
866
881
DriveIn . prototype . seekTo = function ( time ) {
867
882
this . _seeking = true ;
868
883
if ( this . currMediaType === 'video' ) {
@@ -887,8 +902,8 @@ return /******/ (function(modules) { // webpackBootstrap
887
902
/* 4 */
888
903
/***/ function ( module , exports , __webpack_require__ ) {
889
904
890
- /** @jsx React.DOM */ var Jvent = __webpack_require__ ( 6 ) ,
891
- inherits = __webpack_require__ ( 7 ) ;
905
+ /** @jsx React.DOM */ var Jvent = __webpack_require__ ( 7 ) ,
906
+ inherits = __webpack_require__ ( 6 ) ;
892
907
893
908
function Timer ( callback , delay ) {
894
909
var self = this ;
@@ -1005,6 +1020,35 @@ return /******/ (function(modules) { // webpackBootstrap
1005
1020
1006
1021
/***/ } ,
1007
1022
/* 6 */
1023
+ /***/ function ( module , exports , __webpack_require__ ) {
1024
+
1025
+ /** @jsx React.DOM */ if ( typeof Object . create === 'function' ) {
1026
+ // implementation from standard node.js 'util' module
1027
+ module . exports = function inherits ( ctor , superCtor ) {
1028
+ ctor . super_ = superCtor
1029
+ ctor . prototype = Object . create ( superCtor . prototype , {
1030
+ constructor : {
1031
+ value : ctor ,
1032
+ enumerable : false ,
1033
+ writable : true ,
1034
+ configurable : true
1035
+ }
1036
+ } ) ;
1037
+ } ;
1038
+ } else {
1039
+ // old school shim for old browsers
1040
+ module . exports = function inherits ( ctor , superCtor ) {
1041
+ ctor . super_ = superCtor
1042
+ var TempCtor = function ( ) { }
1043
+ TempCtor . prototype = superCtor . prototype
1044
+ ctor . prototype = new TempCtor ( )
1045
+ ctor . prototype . constructor = ctor
1046
+ }
1047
+ }
1048
+
1049
+
1050
+ /***/ } ,
1051
+ /* 7 */
1008
1052
/***/ function ( module , exports , __webpack_require__ ) {
1009
1053
1010
1054
/** @jsx React.DOM */ 'use strict' ;
@@ -1167,35 +1211,6 @@ return /******/ (function(modules) { // webpackBootstrap
1167
1211
module . exports = Jvent ;
1168
1212
1169
1213
1170
- /***/ } ,
1171
- /* 7 */
1172
- /***/ function ( module , exports , __webpack_require__ ) {
1173
-
1174
- /** @jsx React.DOM */ if ( typeof Object . create === 'function' ) {
1175
- // implementation from standard node.js 'util' module
1176
- module . exports = function inherits ( ctor , superCtor ) {
1177
- ctor . super_ = superCtor
1178
- ctor . prototype = Object . create ( superCtor . prototype , {
1179
- constructor : {
1180
- value : ctor ,
1181
- enumerable : false ,
1182
- writable : true ,
1183
- configurable : true
1184
- }
1185
- } ) ;
1186
- } ;
1187
- } else {
1188
- // old school shim for old browsers
1189
- module . exports = function inherits ( ctor , superCtor ) {
1190
- ctor . super_ = superCtor
1191
- var TempCtor = function ( ) { }
1192
- TempCtor . prototype = superCtor . prototype
1193
- ctor . prototype = new TempCtor ( )
1194
- ctor . prototype . constructor = ctor
1195
- }
1196
- }
1197
-
1198
-
1199
1214
/***/ }
1200
1215
/******/ ] )
1201
1216
} ) ;
0 commit comments