动态创建播放器在 IE 中不起作用



我正试图将mediaelement.js作为库的一部分,在库中,图像或视频可以根据单击的缩略图进行交换。URL在这里:http://www.altny.com/portfolio/interactive.html

这是我的代码(在一个单独的.js文件中使用jquery)

// portfolio image/video swap
$("div.gallery-thumb a.gallery-swap").click(function() {
var newDesc = "<p>" + $(this).attr("title") + "</p>";
var newSource = $(this).attr("href");
if ($(this).attr("rel") == "image") {
    var newImage = "url(" + newSource + ")";
    $("section#project-image").empty().css("background-image",newImage);
    $("section#project-image").prepend(newDesc);
} else if ($(this).attr("rel") == "video") {
    // video handling
    $("section#project-image").css("background-image","none").empty().prepend("<video id="project-player" src="" + newSource + "" width="400" height="270"></video>");
    $("video#project-player").mediaelementplayer();
    $("div.mejs-container").css("margin","0 auto");
    $("section#project-image").append(newDesc);
}
return false;
});

这适用于Safari和Firefox,但在IE8中不起作用(我现在无法访问7或9)。我是否使用mediaelement.js不正确?

可能需要放入:

    $("video#project-player").mediaelementplayer();

下图:

    $("section#project-image").append(newDesc);

为了让IE7发挥作用,我不得不做一些类似的事情。

然而,除此之外,我在IE8中使用MediaElement.js时也遇到了问题,我在这里也看到了其他问题。

最新更新