Skip to content

Commit

Permalink
Force the use of Flash when the browser is IE or Edge on Windows 10.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommy Ingulfsen committed Sep 12, 2016
1 parent ef81ca0 commit 430ae55
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/assets/javascripts/modules/media_viewer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//= require modules/thumb_slider
//= require video.js/video.js
//= require videojs-contrib-hls/videojs-contrib-hls.js
//= require client.js/client.min.js
/*global ThumbSlider */
/*global videojs */

Expand Down Expand Up @@ -146,11 +147,23 @@
return hlsSource.prop('src').indexOf('/mp3:') >= 0;
}

function ms10Browser() {
var fingerprinter = new ClientJS();
var browser = fingerprinter.getBrowser();
return (((browser.toLowerCase() === 'edge') || (browser.toLowerCase() === 'ie')) &&
fingerprinter.getOS().toLowerCase() === 'windows' &&
fingerprinter.getOSVersion().toLowerCase() === '10');
}

// We must use flash for MP3s on browsers that do not support HLS natively.
// This is a simple boolean function that can easily tell us if the current
// browser does not support HLS and the media is an MP3
// browser does not support HLS and the media is an MP3. We also use flash
// on Windows 10 Microsoft browsers (IE and Edge) because of a known issue
// with the VideoJS HLS plugin. See
// https://github.com/videojs/videojs-contrib-hls/issues/833
function mustUseFlash(mediaObject) {
return (!canPlayHLS() && mediaObjectIsMP3(mediaObject));
return (ms10Browser() ||
(!canPlayHLS() && mediaObjectIsMP3(mediaObject)));
}

// Remove the HLS source for MP3 files if the browser
Expand Down
Loading

0 comments on commit 430ae55

Please sign in to comment.