dongyuandou2521 2011-12-15 22:04
浏览 71
已采纳

在IE8中调用AJAX后,mediaelement.js无效

I have an absolutely crazy-making bug going on in IE8. At the moment, the following code works everywhere but IE8.

If I run this in chrome, with the alerts enabled "success" fires. If I run it in IE "error" does.

Sadly, in IE I can't seem to track down any sort of verbose error message.

Is there anyone who has figured this out? I'm going bonkers trying to figure it out.

<?php
function the_ajax(){
$video_embed =  "<video id='myvideo' width='$videowidth' height='$videoheight' poster='$large' controls='controls' preload='none'>
    <source type='video/mp4' src='$videomp4' />
    <source type='video/webm' src='$videowebm' />
    <source type='video/ogg' src='$videoogg' />
    <object width='$videowidth' height='$videoheight' type='application/x-shockwave-flash' data='$siteroot/js/mediaelement/flashmediaelement.swf'>
    <param name='movie' value='$siteroot/js/mediaelement/flashmediaelement.swf' />
    <param name='flashvars' value='controls=true&file=$videomp4' />
    <img src='$large' width='$videowidth' height='$videoheight' title='No video playback capabilities' />
    </object>
</video>";
echo $video_embed;
}
?>

and the javascript:

<script type="text/javascript">
$.ajax({
    url: 'wp-admin/admin-ajax.php?action=get_my_video&name='+thevideo, 
    cache: false,
    type: 'GET',
    success: function(response, textStatus, jqXHR){
    contentArea.html(response);
    $("#myvideo").mediaelementplayer({
        enablePluginDebug: true,
        plugins:["flash","silverlight"],
        type: '',
        pluginPath: "/js/mediaelement/",
        flashName:  "flashmediaelement.swf",
        silverlightName: 'silverlightmediaelement.xap',
        success:function(mediaElement, domObject) { 
                //alert('success');
        },
        error: function () { 
            GLOBAL_ERR = this;
            //alert('unknown error');
        }
    });
});
</script>

Incidentally, the "sample output" in IE8 shows the POSTER IMAGE stacked on top of a large block of white space. If you right click the white space it will say "about flash" etc... so it seems to be that the flash player isn't actually initializing.

EDIT I have found a way to get the video playing - (wooo!) but the poster/flas is still stacked. The key to getting the video playing in IE8 is changing the opening VIDEO tag. Add src='$videomp4' to the opening tag.

 <video id='myvideo' width='$videowidth' height='$videoheight' poster='$large' controls='controls' preload='none' src='$videomp4'>

EDIT2

As it turns out removing everything from <object to </object> actually fixes the layout issue in IE8. Videos seem to be playable in Chrome, F, FF3.6 & IE8

I haven't tested anything else and I worry that I've lost something somewhere... but for everything I've tested this seems to be working.

  • 写回答

1条回答 默认 最新

  • duanhong8839 2012-01-12 16:03
    关注

    As it turns out removing everything from <object> to </object> actually fixes the layout issue in IE8. Videos seem to be playable in Chrome, FF3.6 & IE8

    I haven't tested anything else and I worry that I've lost something somewhere... but for everything I've tested this seems to be working.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路