mediaelement.js: Local Flash playback shows black

2019-04-13 11:29发布

问题:

When using mediaelement.js for playback from a webserver, everything works as it should.

If I try running from my local hard disk, in HTML 5 the video plays fine, however, when the flash player is used the audio plays but the video is black. If I select full screen, the video plays.

This occurs even with the Demo players that are included as part of the download.

Does anyone know if there is a fix for this?

回答1:

After some experimenting I was able to resolve my own question.

I added an explicit call to setVideoSize with the correct dimensions and now the video displays when run from the local drive as well as from a web server.

Example:

$('video').mediaelementplayer({
    enableAutosize: true,
    success: function(player, node) {
        player.setVideoSize(480,320);
    }
});