project Websites / videos.bentasker.co.uk avatar

Websites / videos.bentasker.co.uk: 0aace65f




VID-5 Add playlist nav buttons - Prev/Next to control bar

VID-5 Add playlist nav buttons - Prev/Next to control bar

Commit 0aace65f.

Authored 2019-12-15T13:33:20.000+00:00 by B Tasker in project Websites / videos.bentasker.co.uk

+38 lines -0 lines

Changes

diff --git a/resources/embed/embed.js b/resources/embed/embed.js
--- a/resources/embed/embed.js
+++ b/resources/embed/embed.js
# @@ -273,6 +273,44 @@ function writePlayer(vidid,playerSettings){
# ss = "window.player" + vidid +".playlistUi();";
# c.appendChild(s);
# */
# +
# +
# + // Add Next/Previous controls to the player's control bar
# + var s = cE('script');
# + s.innerHTML = 'var VjsButton = videojs.getComponent("Button"); \
# + var nextButton = videojs.extend(VjsButton, { \
# + constructor: function(player, options){ \
# + VjsButton.call(this, player, options); \
# + this.controlText("Next"); \
# + }, \
# + handleClick: function() { \
# + window.player'+ vidid + '.playlist.next(); \
# + }, \
# + buildCSSClass: function() { \
# + return "vjs-icon-next-item vjs-control vjs-button"; \
# + } \
# + }); \
# + var prevButton = videojs.extend(VjsButton, { \
# + constructor: function(player, options){ \
# + VjsButton.call(this, player, options); \
# + this.controlText("Previous"); \
# + }, \
# + handleClick: function() { \
# + window.player'+ vidid + '.playlist.previous(); \
# + }, \
# + buildCSSClass: function() { \
# + return "vjs-icon-previous-item vjs-control vjs-button"; \
# + } \
# + }); \
# + \
# + videojs.registerComponent("prevButton", prevButton); \
# + videojs.registerComponent("NextButton", nextButton); \
# + window.player'+ vidid + '.getChild("controlBar").addChild("prevButton", {}); \
# + window.player'+ vidid + '.getChild("controlBar").addChild("nextButton", {});';
# +
# + c.appendChild(s);
# +
# +
# // The player now exists, so we need to build the playlist
# fetchM3U(playerSettings['vidurl'],vidid);
# }
#