本文介绍了如何使用jwplayer 7在控制栏中添加其他按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am interested in adding a download video button, similar to the one here -- http://support.jwplayer.com/customer/portal/articles/1436999-example-adding-a-download-button. However, I would like to add it within the control bar (a download arrow to the far right).

我如何在jwplayer 7的控制栏中添加其他按钮?

How would I add in additional buttons to the controlbar in 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());
                });

这篇关于如何使用jwplayer 7在控制栏中添加其他按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 14:24