Firefox在新标签页中打开MP4文件,而不是HTML视频播放器

问题描述 投票:0回答:1

我根据本教程制作了一个MP4视频播放器:http://www.lastrose.com/html5-audio-video-playlist/

它在Chrome和Internet Explorer中运行良好,但Firefox会在新选项卡中将每个链接打开为MP4文件。它播放播放列表中的第一个视频就好了,但是当点击播放列表中的任何链接时,Firefox会打开一个新标签而不是将其发送给播放器。

Firefox说:

TypeError:video [0] .play不是函数。

我刚刚将音频变量名称更改为视频:

function init() {
    current = 0;
    video = $('#video');
    playlist = $('#playlist');
    tracks = playlist.find('li a');
    len = tracks.length - 1;
    video.volume = .10;
    video[0].play();
    playlist.find('a').click(function (e) {
        e.preventDefault();
        link = $(this);
        current = link.parent().index();
        run(link, video[0]);
    });
    video[0].addEventListener('ended', function (e) {
        current++;
        if (current == len) {
            current = 0;
            link = playlist.find('a')[0];
        } else {
            link = playlist.find('a')[current];
        }
        run($(link), video[0]);
    });
}

我找到了关于这个的老话题,说Firefox不能在HTML视频播放器中播放MP4,但我想知道是否仍然如此。

html firefox video mp4 video-player
1个回答
0
投票

您的Firefox很可能无法播放MP4 / H.264。你可以在这里查看:http://www.quirksmode.org/html5/tests/video.html

最近版本的FF(26+)确实支持H.264。

© www.soinside.com 2019 - 2024. All rights reserved.