如何使用 jwplayer 7 将附加按钮添加到控制栏

How to add an additional button to the controlbar with jwplayer 7

我有兴趣添加一个下载视频按钮,类似于此处的按钮 -- http://support.jwplayer.com/customer/portal/articles/1436999-example-adding-a-download-button。但是,我想将它添加到控制栏中(最右侧的下载箭头)。

如何在 jwplayer 7 的控制栏中添加额外的按钮?

playerInstance.on('ready',function() {
                    if (jwplayer().getRenderingMode() == "html5"){
                        videoTag = document.querySelector('video');
                         if(videoTag.playbackRate) {
                            playerInstance.addButton(
                                "icon_dir.png",
                                "0.25x", 
                                function() {
                                  changeSpeed(0.25);
                                },
                                "0p25xslow"
                            );

                            playerInstance.addButton(
                                "icon_dir.png",
                                "0.5x", 
                                function() {
                                  changeSpeed(0.5);
                                },
                                "0p5slow"
                            );

                            playerInstance.addButton(
                                "icon_dir.png",
                                "1x", 
                                function() {
                                  changeSpeed(1);
                                },
                                "1xnormal"
                            );

                            playerInstance.addButton(
                                "icon_dir.png",
                                "1.5x", 
                                function() {
                                  changeSpeed(1.5);
                                },
                                "1p5xforward"
                            );

                            playerInstance.addButton(
                                "icon_dir.png",
                                "2x", 
                                function() {
                                  changeSpeed(2);
                                },
                                "2xforward"
                            );
                        }
                    }
                    else{
                        alert("your browser doesn't support HTML5,cant't change speed.");
                    }
                    console.log("state is :"+playerInstance.getState());
                });

对于 JW Player 7.3,您可以通过 JS 执行此操作

    playerInstance.onReady(function(){
            var myLogo = document.createElement("div");
            myLogo.id = "myTestLogo";
            myLogo.setAttribute('style',"color: red; padding-left: 5px; margin-right: 5px; margin-top: 10px; background-image: url('/icon_dir.png');background-repeat: no-repeat;");
            myLogo.setAttribute('class','jw-icon jw-icon-inline jw-button-color jw-reset jw-icon-logo');
            myLogo.setAttribute('onclick','window.location="http://jwplayer.com"');
            document.getElementsByClassName('jw-controlbar-right-group')[0].appendChild(myLogo);
    });