Reputation: 155
i have implemented jwplayer 6 into my project and i get an error in IE8 Console SCRIPT5007: Unable to get property 'cssRules' of undefined or null reference jwplayer.html5.js, line 9 character 34
Whats cause this issue
Here is the screen shot and link http://dev.www.infopave.com/Page/Index/PRESENTATIONS
Click on any video link and see the console in IE8,IE9 any help will be highly appriciated.
Thanks
Here is my code
// Get Jwplayer Events and submit to google analytics add by noor03/12/2014
function LoadVideoDynamically(VideoFileName, VideoFileTitle, VideoPageURL) {
jwplayer("mediaplayer").setup({
file: VideoFileName, //exp //file: 'rtmp://s1nu7pjztotbeg.cloudfront.net/cfx/st/mp4:Help/How_To/GettingStarted_V2-Med_x264.mp4',
width: "100%",
height: "545",
autostart: true,
events: {
onComplete: function (event) {
ga('send', 'event', 'Video Completes', ''+VideoFileName+'', '' + VideoFileTitle + '');
},
onReady: function (event) {
ga('send', 'event', 'Video Plays', '' + VideoFileName + '', '' + VideoFileTitle + '');
}
}
});
function setText(id, messageText) {
document.getElementById(id).innerHTML = messageText;
}
}
Upvotes: 1
Views: 1533
Reputation: 735
Better way is add this two block too:
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!--[if (gt IE 8)|!(IE)]><!-->
<script src="jwplayer.html5.js" type="text/javascript"></script>
<!--<![endif]-->
Upvotes: 0
Reputation: 1302
I was getting this bug too. It appears that there's a jwplayer bug in IE8 that they haven't addressed yet. I didn't look too much into it, but it looks like it's possible IE8 doesn't load stylesheets before JS, making something like document.styleSheets[0].cssRules
a null object. The bug seems to go away after a full page load (second iteration through the code), but at that point it's too late.
http://www.longtailvideo.com/support/forums/jw-player/bug-reports/30546/cssrules-error-in-ie8-script5007/ http://www.longtailvideo.com/support/forums/jw-player/bug-reports/35845/ssheetcssrules-is-null-or-not-an-object-error-in-ie8/
Anyway, my quick fix was to prevent the html5 js from loading in IE8:
<!--[if (gt IE 8)|!(IE)]><!-->
<script src="jwplayer.html5.js" type="text/javascript"></script>
<!--<![endif]-->
IE8 uses the flash version, so it doesn't need this code.
Upvotes: 2