Skip to content

Commit fd9a872

Browse files
committed
Fix various JW & IE8 bugs
1 parent a85e1c7 commit fd9a872

8 files changed

Lines changed: 71 additions & 56 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.DS_Store
22
thirdparty/jwplayer.*
3+
translations/???.js

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ Fallback
6565

6666
For older browsers that don’t support HTML5 media elements, you need a
6767
fallback solution. *Able Player* was developed to work seamlessly with
68-
[JW Player][], specifically **JW Player 6**. JW Player is free for
69-
non-commercial use but is licensed separately and is not distributed
70-
with *Able Player*. If you choose to use JW Player as your fallback
71-
player, users with older browsers including Internet Explorer 6-8 will
68+
[JW Player][], specifically **JW Player 6** (successfully tested with
69+
versions 6.0 and 6.11). JW Player is free for non-commercial use but
70+
is licensed separately and is not distributed with *Able Player*.
71+
If you choose to use JW Player as your fallback player,
72+
users with older browsers including Internet Explorer 6-8 will
7273
have the same experience with *Able Player* as users with newer
7374
browsers. Identical functionality has been attained using both the HTML5
7475
and JW Player APIs. After licensing and downloading JW PLayer, copy

build/ableplayer.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
1111
// Uses JW Player as fallback
1212
// JW Player configuration options:
13-
// http://www.longtailvideo.com/support/jw-player/28839/embedding-the-player
13+
// http://support.jwplayer.com/customer/portal/articles/1413113-configuration-options-reference
1414
// (NOTE: some options are not documented, e.g., volume)
15-
// JW Player API reference:
16-
// http://www.longtailvideo.com/support/jw-player/28851/javascript-api-reference
15+
// JW Player 6 API reference:
16+
// http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference
1717
1818
// YouTube Player API for iframe Embeds
1919
https://developers.google.com/youtube/iframe_api_reference
@@ -302,29 +302,29 @@
302302
// If NOT using JW Player, set to false. An error message will be displayed if browser can't play the media.
303303
this.fallback = 'jw';
304304

305+
// fallback path - specify path to fallback player files
306+
this.fallbackPath = '../thirdparty/';
307+
305308
// testFallback - set to true to force browser to use the fallback player (for testing)
306309
// Note: JW Player does not support offline playback (a Flash restriction)
307310
// Therefore testing must be performed on a web server
308-
this.testFallback = true;
311+
this.testFallback = false;
312+
313+
// translationPath - specify path to translation files
314+
this.translationPath = '../translations/';
309315

310-
// loop - if true, will start again at top after last item in playlist has ended
311-
// NOTE: This is not fully supported yet - needs work
312-
this.loop = true;
313-
314316
// lang - default language of the player
315317
this.lang = 'en';
316318

317319
// forceLang - set to true to force player to use default player language
318320
// set to false to reset this.lang to language of the web page or user's browser,
319321
// if either is detectable and if a matching translation file is available
320322
this.forceLang = false;
321-
322-
// translationPath - specify path to translation files
323-
this.translationPath = '../translations/';
324-
325-
// fallback path - specify path to fallback player files
326-
this.fallbackPath = '../thirdparty/';
327-
323+
324+
// loop - if true, will start again at top after last item in playlist has ended
325+
// NOTE: This is not fully supported yet - needs work
326+
this.loop = true;
327+
328328
// lyricsMode - line breaks in WebVTT caption file are always supported in captions
329329
// but they're removed by default form transcripts in order to form a more seamless reading experience
330330
// Set lyricsMode to true to add line breaks between captions, and within captions if there are "\n"
@@ -661,14 +661,19 @@
661661
$.each(thisObj.$sources, function (ii, source) {
662662
sources.push({file: $(source).attr('src')});
663663
});
664-
664+
665+
var flashplayer = thisObj.fallbackPath + 'jwplayer.flash.swf';
666+
// var flashplayer = '../thirdparty/jwplayer.flash.swf';
667+
var html5player = thisObj.fallbackPath + 'jwplayer.html5.js';
668+
// var html5player = '../thirdparty/jwplayer.html5.js';
669+
665670
if (thisObj.mediaType === 'video') {
666671
thisObj.jwPlayer = jwplayer(thisObj.jwId).setup({
667672
playlist: [{
668673
sources: sources
669674
}],
670-
flashplayer: thisObj.fallbackPath + 'jwplayer.flash.swf',
671-
html5player: thisObj.fallbackPath + 'jwplayer.html5.js',
675+
flashplayer: flashplayer,
676+
html5player: html5player,
672677
image: thisObj.$media.attr('poster'),
673678
controls: false,
674679
volume: thisObj.defaultVolume * 100,
@@ -684,16 +689,15 @@
684689
playlist: [{
685690
sources: sources
686691
}],
687-
flashplayer: thisObj.fallbackPath + 'jwplayer.flash.swf',
688-
html5player: thisObj.fallbackPath + 'jwplayer.html5.js',
692+
flashplayer: flashplayer,
693+
html5player: html5player,
689694
controls: false,
690695
volume: this.defaultVolume * 100,
691696
height: jwHeight,
692697
fallback: false,
693698
primary: 'flash'
694699
});
695700
}
696-
697701
// remove the media element - we're done with it
698702
// keeping it would cause too many potential problems with HTML5 & JW event listeners both firing
699703
thisObj.$media.remove();
@@ -2330,7 +2334,7 @@
23302334
'name': radioName,
23312335
'id': radioId
23322336
});
2333-
if (track.default) {
2337+
if (track.def) {
23342338
trackButton.attr('checked','checked');
23352339
hasDefault = true;
23362340
}
@@ -3188,7 +3192,7 @@
31883192
'cues': cues,
31893193
'language': trackLang,
31903194
'label': trackLabel,
3191-
'default': isDefaultTrack
3195+
'def': isDefaultTrack
31923196
});
31933197
if (this.includeTranscript) {
31943198
if (isDefaultTrack) {
@@ -3208,7 +3212,7 @@
32083212
'cues': cues,
32093213
'language': trackLang,
32103214
'label': trackLabel,
3211-
'default': isDefaultTrack
3215+
'def': isDefaultTrack
32123216
});
32133217
if (this.includeTranscript) {
32143218
if (isDefaultTrack) {
@@ -3227,7 +3231,7 @@
32273231
'cues': cues,
32283232
'language': trackLang,
32293233
'label': trackLabel,
3230-
'default': isDefaultTrack
3234+
'def': isDefaultTrack
32313235
});
32323236
if (this.includeTranscript) {
32333237
if (isDefaultTrack) {

scripts/ableplayer-base.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
1111
// Uses JW Player as fallback
1212
// JW Player configuration options:
13-
// http://www.longtailvideo.com/support/jw-player/28839/embedding-the-player
13+
// http://support.jwplayer.com/customer/portal/articles/1413113-configuration-options-reference
1414
// (NOTE: some options are not documented, e.g., volume)
15-
// JW Player API reference:
16-
// http://www.longtailvideo.com/support/jw-player/28851/javascript-api-reference
15+
// JW Player 6 API reference:
16+
// http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference
1717
1818
// YouTube Player API for iframe Embeds
1919
https://developers.google.com/youtube/iframe_api_reference

scripts/buildplayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@
403403
'name': radioName,
404404
'id': radioId
405405
});
406-
if (track.default) {
406+
if (track.def) {
407407
trackButton.attr('checked','checked');
408408
hasDefault = true;
409409
}

scripts/initialize.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,29 +56,29 @@
5656
// If NOT using JW Player, set to false. An error message will be displayed if browser can't play the media.
5757
this.fallback = 'jw';
5858

59+
// fallback path - specify path to fallback player files
60+
this.fallbackPath = '../thirdparty/';
61+
5962
// testFallback - set to true to force browser to use the fallback player (for testing)
6063
// Note: JW Player does not support offline playback (a Flash restriction)
6164
// Therefore testing must be performed on a web server
62-
this.testFallback = true;
65+
this.testFallback = false;
66+
67+
// translationPath - specify path to translation files
68+
this.translationPath = '../translations/';
6369

64-
// loop - if true, will start again at top after last item in playlist has ended
65-
// NOTE: This is not fully supported yet - needs work
66-
this.loop = true;
67-
6870
// lang - default language of the player
6971
this.lang = 'en';
7072

7173
// forceLang - set to true to force player to use default player language
7274
// set to false to reset this.lang to language of the web page or user's browser,
7375
// if either is detectable and if a matching translation file is available
7476
this.forceLang = false;
75-
76-
// translationPath - specify path to translation files
77-
this.translationPath = '../translations/';
78-
79-
// fallback path - specify path to fallback player files
80-
this.fallbackPath = '../thirdparty/';
81-
77+
78+
// loop - if true, will start again at top after last item in playlist has ended
79+
// NOTE: This is not fully supported yet - needs work
80+
this.loop = true;
81+
8282
// lyricsMode - line breaks in WebVTT caption file are always supported in captions
8383
// but they're removed by default form transcripts in order to form a more seamless reading experience
8484
// Set lyricsMode to true to add line breaks between captions, and within captions if there are "\n"
@@ -415,14 +415,19 @@
415415
$.each(thisObj.$sources, function (ii, source) {
416416
sources.push({file: $(source).attr('src')});
417417
});
418-
418+
419+
var flashplayer = thisObj.fallbackPath + 'jwplayer.flash.swf';
420+
// var flashplayer = '../thirdparty/jwplayer.flash.swf';
421+
var html5player = thisObj.fallbackPath + 'jwplayer.html5.js';
422+
// var html5player = '../thirdparty/jwplayer.html5.js';
423+
419424
if (thisObj.mediaType === 'video') {
420425
thisObj.jwPlayer = jwplayer(thisObj.jwId).setup({
421426
playlist: [{
422427
sources: sources
423428
}],
424-
flashplayer: thisObj.fallbackPath + 'jwplayer.flash.swf',
425-
html5player: thisObj.fallbackPath + 'jwplayer.html5.js',
429+
flashplayer: flashplayer,
430+
html5player: html5player,
426431
image: thisObj.$media.attr('poster'),
427432
controls: false,
428433
volume: thisObj.defaultVolume * 100,
@@ -438,16 +443,15 @@
438443
playlist: [{
439444
sources: sources
440445
}],
441-
flashplayer: thisObj.fallbackPath + 'jwplayer.flash.swf',
442-
html5player: thisObj.fallbackPath + 'jwplayer.html5.js',
446+
flashplayer: flashplayer,
447+
html5player: html5player,
443448
controls: false,
444449
volume: this.defaultVolume * 100,
445450
height: jwHeight,
446451
fallback: false,
447452
primary: 'flash'
448453
});
449454
}
450-
451455
// remove the media element - we're done with it
452456
// keeping it would cause too many potential problems with HTML5 & JW event listeners both firing
453457
thisObj.$media.remove();

scripts/track.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
'cues': cues,
119119
'language': trackLang,
120120
'label': trackLabel,
121-
'default': isDefaultTrack
121+
'def': isDefaultTrack
122122
});
123123
if (this.includeTranscript) {
124124
if (isDefaultTrack) {
@@ -138,7 +138,7 @@
138138
'cues': cues,
139139
'language': trackLang,
140140
'label': trackLabel,
141-
'default': isDefaultTrack
141+
'def': isDefaultTrack
142142
});
143143
if (this.includeTranscript) {
144144
if (isDefaultTrack) {
@@ -157,7 +157,7 @@
157157
'cues': cues,
158158
'language': trackLang,
159159
'label': trackLabel,
160-
'default': isDefaultTrack
160+
'def': isDefaultTrack
161161
});
162162
if (this.includeTranscript) {
163163
if (isDefaultTrack) {

tests/jw.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ <h1>JW Player Test</h1>
1515

1616
<p>For additional tests see the <a href="index.html">Index of <em>Able Player</em> Examples</a>.</p>
1717

18-
1918
<div id="media1">Loading the player ...</div>
2019

2120
<script>
2221

2322
var startedPlaying = false;
2423

25-
jwplayer('media1').setup({
24+
var jw = jwplayer('media1').setup({
2625
file: "../media/wwa.mp4",
2726
width: 480,
2827
height: 360,
@@ -45,7 +44,13 @@ <h1>JW Player Test</h1>
4544
// onSeek() is only triggered by the slider
4645
console.log('seeking to ' + event.position + '; goal: ' + event.offset);
4746
});
47+
4848
</script>
4949

50+
<div>
51+
<button onclick="jw.play()">Toggle playback</button>
52+
<button onclick="console.log('Volume: ' + jw.getVolume())">Report volume</button>
53+
</div>
54+
5055
</body>
5156
</html>

0 commit comments

Comments
 (0)