Javascript 如何显示";“以前的”;JW播放器中播放列表的按钮?

Javascript 如何显示";“以前的”;JW播放器中播放列表的按钮?,javascript,button,jwplayer,Javascript,Button,Jwplayer,我正在使用带有播放列表(3项)的JW播放器 但正如您在图中所看到的,它只显示了一个“下一步”按钮 你能帮我显示“上一步”按钮吗 我已经阅读了JW播放器文档,但找不到它。这个“功能”是在JW 7.7.0中引入的,最新的JW版本是JW7.7.6,现在还没有正式的方式来配置/定制/关闭它 它与“下一步”功能和一个新的覆盖播放列表相结合,如果你不在行的话,它会给你的JW实现带来麻烦,但JW团队似乎并不关心这一点 您可以编写自己的JS/CSS来隐藏这些新元素并添加“先前”功能,但目前最干净的方法是恢复使用

我正在使用带有播放列表(3项)的JW播放器

但正如您在图中所看到的,它只显示了一个“下一步”按钮

你能帮我显示“上一步”按钮吗

我已经阅读了JW播放器文档,但找不到它。

这个“功能”是在JW 7.7.0中引入的,最新的JW版本是JW7.7.6,现在还没有正式的方式来配置/定制/关闭它

它与“下一步”功能和一个新的覆盖播放列表相结合,如果你不在行的话,它会给你的JW实现带来麻烦,但JW团队似乎并不关心这一点

您可以编写自己的JS/CSS来隐藏这些新元素并添加“先前”功能,但目前最干净的方法是恢复使用JW7.6.1

你可以在这里链接到云库://ssl.p.jwpcdn.com/player/v/7.6.1/jwplayer.js

这个“功能”是在JW 7.7.0中引入的,最新的JW版本是JW7.7.6,现在还没有正式的方式来配置/定制/关闭它

它与“下一步”功能和一个新的覆盖播放列表相结合,如果你不在行的话,它会给你的JW实现带来麻烦,但JW团队似乎并不关心这一点

您可以编写自己的JS/CSS来隐藏这些新元素并添加“先前”功能,但目前最干净的方法是恢复使用JW7.6.1


您可以在这里链接到云库://ssl.p.jwpcdn.com/player/v/7.6.1/jwplayer.js

以下是我使用JW播放器API中的函数向播放器添加“previous”按钮所要做的。这是给JW播放器8的。注意,它需要jquery将“上一步”按钮移动到“下一步”按钮旁边。我已经在代码中包含了jquery

<div id="player"></div>
<script src="/path/to/your/jwplayer.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
    var player = jwplayer('player');

    jwplayer.key="your license key goes here";

    player.setup({
        playlist: 'https://cdn.jwplayer.com/v2/playlists/6tYY3mSy'
    });


    player.on('ready', function() {

        // The following code uses the addButton function from the JW Player API.
        player.addButton(
            '<svg xmlns="http://www.w3.org/2000/svg" class="jw-svg-icon jw-svg-icon-prev" viewBox="0 0 240 240"><path transform="translate(240, 0) scale(-1, 1) " d="M165,60v53.3L59.2,42.8C56.9,41.3,55,42.3,55,45v150c0,2.7,1.9,3.8,4.2,2.2L165,126.6v53.3h20v-120L165,60L165,60z"></path></svg>',
            'Previous',
            function() {
                if (player.getPlaylistIndex() === 0) {
                    // If the user is at the first video in the playlist, loop around to the last video
                    player.playlistItem( Math.max(0, player.getPlaylist().length - 1) );
                }
                else {
                    // Otherwise, go to the previous video in the playlist
                    player.playlistItem( Math.max(0, player.getPlaylistIndex() - 1) ); 
                }
            },
            'previous',
            'jw-icon-prev'
        );

        // The following line is a hack to move the button next to the "next" button
        // Note that this is not officially supported so use at your own risk. It has worked fine for me so far.
        $('.jw-controlbar .jw-icon-next').before($('.jw-icon-prev'));
    });
</script>

var player=jwplayer(“玩家”);
jwplayer.key=“您的许可证密钥在这里”;
player.setup({
播放列表:'https://cdn.jwplayer.com/v2/playlists/6tYY3mSy'
});
player.on('ready',function(){
//下面的代码使用JW播放器API中的addButton函数。
player.addButton(
'',
"先前",,
函数(){
if(player.getplaylatindex()==0){
//如果用户正在播放列表中的第一个视频,则循环播放最后一个视频
player.playlitem(Math.max(0,player.getPlaylist().length-1));
}
否则{
//否则,转到播放列表中的上一个视频
player.playlitem(Math.max(0,player.getplaylatindex()-1));
}
},
"先前",,
“jw图标上一个”
);
//下面这行是一个将按钮移动到“下一步”按钮旁边的技巧
//请注意,这不是官方支持的,所以使用风险自负。到目前为止,它对我来说效果很好。
$('.jw controlbar.jw icon next')。在($('.jw icon prev'))之前;
});

以下是我使用JW播放器API中的函数向播放器添加“previous”按钮所做的操作。这是给JW播放器8的。注意,它需要jquery将“上一步”按钮移动到“下一步”按钮旁边。我已经在代码中包含了jquery

<div id="player"></div>
<script src="/path/to/your/jwplayer.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
    var player = jwplayer('player');

    jwplayer.key="your license key goes here";

    player.setup({
        playlist: 'https://cdn.jwplayer.com/v2/playlists/6tYY3mSy'
    });


    player.on('ready', function() {

        // The following code uses the addButton function from the JW Player API.
        player.addButton(
            '<svg xmlns="http://www.w3.org/2000/svg" class="jw-svg-icon jw-svg-icon-prev" viewBox="0 0 240 240"><path transform="translate(240, 0) scale(-1, 1) " d="M165,60v53.3L59.2,42.8C56.9,41.3,55,42.3,55,45v150c0,2.7,1.9,3.8,4.2,2.2L165,126.6v53.3h20v-120L165,60L165,60z"></path></svg>',
            'Previous',
            function() {
                if (player.getPlaylistIndex() === 0) {
                    // If the user is at the first video in the playlist, loop around to the last video
                    player.playlistItem( Math.max(0, player.getPlaylist().length - 1) );
                }
                else {
                    // Otherwise, go to the previous video in the playlist
                    player.playlistItem( Math.max(0, player.getPlaylistIndex() - 1) ); 
                }
            },
            'previous',
            'jw-icon-prev'
        );

        // The following line is a hack to move the button next to the "next" button
        // Note that this is not officially supported so use at your own risk. It has worked fine for me so far.
        $('.jw-controlbar .jw-icon-next').before($('.jw-icon-prev'));
    });
</script>

var player=jwplayer(“玩家”);
jwplayer.key=“您的许可证密钥在这里”;
player.setup({
播放列表:'https://cdn.jwplayer.com/v2/playlists/6tYY3mSy'
});
player.on('ready',function(){
//下面的代码使用JW播放器API中的addButton函数。
player.addButton(
'',
"先前",,
函数(){
if(player.getplaylatindex()==0){
//如果用户正在播放列表中的第一个视频,则循环播放最后一个视频
player.playlitem(Math.max(0,player.getPlaylist().length-1));
}
否则{
//否则,转到播放列表中的上一个视频
player.playlitem(Math.max(0,player.getplaylatindex()-1));
}
},
"先前",,
“jw图标上一个”
);
//下面这行是一个将按钮移动到“下一步”按钮旁边的技巧
//请注意,这不是官方支持的,所以使用风险自负。到目前为止,它对我来说效果很好。
$('.jw controlbar.jw icon next')。在($('.jw icon prev'))之前;
});

wow谢谢你的回答!JW7.6对我来说工作得很好。很难理解JW7.7的这个“特性”,哈哈,谢谢你的回答!JW7.6对我来说工作得很好。很难理解JW7.7的这个“特性”,哈哈