9898 }
9999
100100 if ( $ ( media ) . data ( 'youtube-id' ) !== undefined && $ ( media ) . data ( 'youtube-id' ) !== "" ) {
101- // add validation
101+ // move this to <source> element
102102 this . youtubeId = $ ( media ) . data ( 'youtube-id' ) ;
103103 }
104104
105105 if ( $ ( media ) . data ( 'volume' ) !== undefined && $ ( media ) . data ( 'volume' ) !== "" ) {
106- // add validation
107- this . defaultVolume = $ ( media ) . data ( 'volume' ) ;
106+ var volume = $ ( media ) . data ( 'volume' ) ;
107+ if ( volume >= 0 && volume <= 1 ) {
108+ this . defaultVolume = volume ;
109+ }
108110 }
109111
110112 if ( $ ( media ) . data ( 'icon-type' ) !== undefined && $ ( media ) . data ( 'icon-type' ) !== "" ) {
111- // add validation
112- this . iconType = $ ( media ) . data ( 'icon-type' ) ;
113+ var iconType = $ ( media ) . data ( 'icon-type' ) ;
114+ if ( iconType === 'font' || iconType == 'image' ) {
115+ this . iconType = iconType ;
116+ }
113117 }
114118
115119 if ( $ ( media ) . data ( 'seek-interval' ) !== undefined && $ ( media ) . data ( 'seek-interval' ) !== "" ) {
116- // add validation
117- this . seekInterval = $ ( media ) . data ( 'seek-interval' ) ;
120+ var seekInterval = $ ( media ) . data ( 'seek-interval' ) ;
121+ if ( / ^ [ 1 - 9 ] [ 0 - 9 ] * $ / . test ( seekInterval ) ) { // must be a whole number greater than 0
122+ this . seekInterval = seekInterval ;
123+ this . useFixedSeekInterval = true ; // do not override with 1/10 of duration
124+ }
118125 }
119126
120127 if ( $ ( media ) . data ( 'show-now-playing' ) !== undefined && $ ( media ) . data ( 'show-now-playing' ) !== "false" ) {
121128 this . showNowPlaying = true ;
122129 }
123130
124131 if ( $ ( media ) . data ( 'fallback' ) !== undefined && $ ( media ) . data ( 'fallback' ) !== "" ) {
125- // add validation
126- this . fallback = $ ( media ) . data ( 'fallback' ) ;
132+ var fallback = $ ( media ) . data ( 'fallback' ) ;
133+ if ( fallback === 'jw' ) {
134+ this . fallback = fallback ;
135+ }
127136 }
128137
129138 if ( $ ( media ) . data ( 'test-fallback' ) !== undefined && $ ( media ) . data ( 'test-fallback' ) !== "false" ) {
130139 this . testFallback = true ;
131140 }
132141
133142 if ( $ ( media ) . data ( 'lang' ) !== undefined && $ ( media ) . data ( 'lang' ) !== "" ) {
134- this . lang = $ ( media ) . data ( 'lang' ) ;
143+ var lang = $ ( media ) . data ( 'lang' ) ;
144+ if ( lang . length == 2 ) {
145+ this . lang = lang ;
146+ }
135147 }
136148
137149 if ( $ ( media ) . data ( 'lang-override' ) !== undefined && $ ( media ) . data ( 'lang-override' ) !== "false" ) {
266278
267279 // Browsers that don't support seekbar sliders will use rewind and forward buttons
268280 // seekInterval = Number of seconds to seek forward or back with these buttons
281+ // NOTE: Unless user overrides this default with data-seek-interval attribute,
282+ // this value is replaced by 1/10 the duration of the media file, once the duration is known
269283 this . seekInterval = 10 ;
270284
271285 // In ABLE's predecessor (AAP) progress sliders were included in supporting browsers
572586 thisObj . $media [ 0 ] . load ( ) ;
573587 }
574588
575- // 10 steps in seek interval; wait until the end so that we can fetch a duration.
576- thisObj . seekInterval = Math . max ( 10 , thisObj . getDuration ( ) / 10 ) ;
577-
589+ if ( this . useFixedSeekInterval === false ) {
590+ // 10 steps in seek interval; wait until the end so that we can fetch a duration.
591+ thisObj . seekInterval = Math . max ( 10 , thisObj . getDuration ( ) / 10 ) ;
592+ }
593+
578594 deferred . resolve ( ) ;
579595 } ) ;
580596
11361152( function ( ) {
11371153 // See section 4.1 of dev.w3.org/html5/webvtt for format details.
11381154 AblePlayer . prototype . parseWebVTT = function ( text ) {
1155+
11391156 // Normalize line ends to \n.
11401157 text . replace ( '\r\n' , '\n' ) . replace ( '\r' , '\n' ) ;
11411158
13841401 }
13851402
13861403 var token = getCueToken ( state ) ;
1404+
13871405 // We'll use the tokens themselves as objects where possible.
13881406 if ( token . type === 'string' ) {
13891407 current . children . push ( token ) ;
14531471 }
14541472 }
14551473 }
1456-
14571474 return result ;
14581475 }
14591476
14771494 // End of file.
14781495 c = '\u0004' ;
14791496 }
1480-
1497+
14811498 if ( tokenState === 'data' ) {
14821499 if ( c === '&' ) {
14831500 buffer = '&' ;
@@ -4427,6 +4444,7 @@ console.log('number of matching parent elements: ' + prevHeading.length);
44274444 } ;
44284445
44294446 AblePlayer . prototype . handleRewind = function ( ) {
4447+ console . log ( 'rewinding ' + this . seekInterval + ' seconds' ) ;
44304448 var targetTime = this . getElapsed ( ) - this . seekInterval ;
44314449 if ( targetTime < 0 ) {
44324450 this . seekTo ( 0 ) ;
@@ -4437,6 +4455,7 @@ console.log('number of matching parent elements: ' + prevHeading.length);
44374455 } ;
44384456
44394457 AblePlayer . prototype . handleFastForward = function ( ) {
4458+ console . log ( 'fast forwarding ' + this . seekInterval + ' seconds' ) ;
44404459 var targetTime = this . getElapsed ( ) + this . seekInterval ;
44414460
44424461 if ( targetTime > this . getDuration ( ) ) {
0 commit comments