问题
I've been testing a site using MediaElement.JS and have been very impressed thus far. I have tested the Flash fallback support on FF and Safari on Mac. I've also tested it on Windows 7 with IE9 and Google Chrome. Everything works and if the codec cannot load it uses the mp4 version of the video I have with the Flash player.
However, upon testing it in IE7, the Flash player does not load. I do not even see any controls for the video and with right-clicking on the element I do not get the standard Flash settings menu. It does however have a black box where the element should appear (and it's not my styling).
Here is my video element block with Flash fallback support:
<video id="video-tag" width="640" height="360" poster="war-torn.png" controls="controls" preload="none">
<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
<source id="source-mp4" type="video/mp4" src="war-torn.mp4" />
<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
<!-- Flash fallback for non-HTML5 browsers without JavaScript -->
<object width="320" height="240" type="application/x-shockwave-flash" data="flashmediaelement.swf">
<param name="movie" value="flashmediaelement.swf" />
<param name="flashvars" value="controls=true&poster=war-torn.png&file=war-torn.mp4" />
<!-- Image as a last resort -->
<img src="war-torn.png" width="320" height="240" title="No video playback capabilities" />
</object>
</video>
I am implementing MediaElement.JS further down in my page like so:
<script src="../build/mediaelement-and-player.min.js"></script>
<script>
$("#video-tag").mediaelementplayer({
features: ['playpause','progress','current','volume']
});
</script>
I am not sure what is going on since if I remove the tag for WebM and FF uses the Flash fallback it works perfectly. If anyone has any insight, it would be much appreciated. Thank you!
I receive this error message as well:
'0.url' is null or not an object
mediaelement-and-player.min.js
Code: 0
URI: url to js file
Line: 41
Char: 4
It does not work in IE7 compatibility mode either.
回答1:
I was able to resolve the issue by doing two things. First, I moved the mediaelement-and-player.min.js
script tag up to the head and, next, I moved the .mediaelementplayer()
call after the html for the video tag.
This appears to have resolved the problem. Weird.
来源:https://stackoverflow.com/questions/8126932/flash-fallback-not-working-with-ie7-on-windows-xp-sp2