3

我这样称呼flowplayer:

flowplayer("a.rmPlayer", "libs/flowplayer/flowplayer.swf", {
        plugins: {
            audio: {
                url: 'libs/flowplayer/flowplayer.audio.swf'
            },
            controls:  {
                volume: true
            }
        }
     });

我现在想为每个被调用的 mp3 文件设置不同的封面。flowplayer 提供了coverimage 变量(请参阅http://flash.flowplayer.org/plugins/streaming/audio.html),但是我可以以某种方式将图像包含在数据属性中吗?

4

1 回答 1

0

我最终使用了以下代码,这似乎完美无缺。链接:

<a data-toggle="modal" class="rmPlayer" data-fpurl="http://releases.flowplayer.org/data/fake_empire.mp3" data-fpimg="http://releases.flowplayer.org/data/national.jpg">click me</a>

以及相应的 javascript('#rmPlayerInterface' 是模态窗口)

<script type="text/javascript">
$(document).ready(function() {
    player = flowplayer("player", "/libs/flowplayer/flowplayer.swf", {
        plugins: {audio: {url: '/libs/flowplayer/flowplayer.audio.swf'},controls: {url: '/libs/flowplayer/flowplayer.controls.swf'}}, 
        clip: {autoplay: false, autoBuffering: true}
    });

    $(document).on("click", ".rmPlayer", function () {
        $('#rmPlayerInterface').data('playeroptions', $(this).data());//.music = music;
        $('#rmPlayerInterface').modal('show');//:music});//('music', $(this).data('music'));
    });

    $('#rmPlayerInterface').on('show', function () {
        var poptions = $('#rmPlayerInterface').data('playeroptions');
        var c = {url: poptions["fpurl"],coverImage: {url: poptions["fpimg"],scaling: 'orig'}};
        player.play(c);
    });

    $('#rmPlayerInterface').on('hide', function () {
        player.pause();
    });
});

</script>
于 2013-05-17T12:46:48.977 回答