Reputation: 1772
Google Chrome is no longer prompting users on my site to enable flash which is required to play the videos that the users upload. This is a recent change and I think it's due to Chrome slowly disabling flash over the year 2017 (I haven't changed anything). It works fine on Firefox.
The best solution is to convert videos to mp4 rather than flv, but right now this second I need to fix the problem for those actively using the site. I need a way to force the browser to prompt the user to enable flash. I know it's possible as I've seen it on other sites but I'm not sure how ATM. Any ideas?
Here's the code that plays the video:
<script type='text/javascript' src='/jwplayer/swfobject.js'>/script>
<div id='mediaspaceX'>This text will be replaced</div>
<script type='text/javascript'>
var so = new SWFObject('/jwplayer/player.swf','mpl',640,480,'9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('file',escape('the_video.flv'));
so.addVariable('backcolor','111111');
so.addVariable('frontcolor','7fc9eb');
so.addVariable('lightcolor','cd6a28');
so.addVariable('screencolor','000000');
so.addVariable('playlistsize','0');
so.addVariable('skin','/jwplayer/stylish.swf');
so.write('mediaspaceX');
</script>
Upvotes: 2
Views: 4715
Reputation: 41
A simple
<a href="https://get.adobe.com/flashplayer">Enable Flash</a>
will do the job.
Upvotes: 4
Reputation: 1261
You can force browser to show permission prompt using this hack:
/**
* Tries to show browser's promt for enabling flash
*
* Chrome starting from 56 version and Edge from 15 are disabling flash
* by default. To promt user to enable flash, they suggest to send user to
* flash player download page. Then this browser will catch such request
* and show a promt to user:
* https://www.chromium.org/flash-roadmap#TOC-Developer-Recommendations
* In this method we are forcing such promt by navigating user to adobe
* site in iframe, instead of top window
*/
function requestFlashPermission() {
var iframe = document.createElement('iframe');
iframe.src = 'https://get.adobe.com/flashplayer';
iframe.sandbox = '';
document.body.appendChild(iframe);
document.body.removeChild(iframe);
}
var isNewEdge = (navigator.userAgent.match(/Edge\/(\d+)/) || [])[1] > 14;
var isNewSafari = (navigator.userAgent.match(/OS X (\d+)/) || [])[1] > 9;
var isNewChrome = (navigator.userAgent.match(/Chrom(e|ium)\/(\d+)/) || [])[2] > 56
&& !/Mobile/i.test(navigator.userAgent);
var canRequestPermission = isNewEdge || isNewSafari || isNewChrome;
if (!swfobject.hasFlashPlayerVersion('10') && canRequestPermission) {
// in case, when flash is not available, try to prompt user to enable it
requestFlashPermission();
// Chrome requires user's click in order to allow iframe embeding
$(window).one('click', requestFlashPermission);
}
Based on: https://www.chromium.org/flash-roadmap#TOC-Developer-Recommendations
Upvotes: 3