From 2e5bb5ade7ca29c625f5a73560840e6a11ce21fb Mon Sep 17 00:00:00 2001 From: Kasper Moskwiak Date: Tue, 5 Apr 2016 23:09:56 +0200 Subject: [PATCH] hls init --- examples/hls.html | 66 ++++++++++++++++++++++++++++++ lib/videojs-resolution-switcher.js | 16 ++++++++ package.json | 5 ++- 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 examples/hls.html diff --git a/examples/hls.html b/examples/hls.html new file mode 100644 index 0000000..74c8f53 --- /dev/null +++ b/examples/hls.html @@ -0,0 +1,66 @@ + + + + + Video.js Resolution Switcher + + + + + + +
+

+ HLS tech +

+
+ + + + + + + + + diff --git a/lib/videojs-resolution-switcher.js b/lib/videojs-resolution-switcher.js index 5b1448e..b96dbb8 100644 --- a/lib/videojs-resolution-switcher.js +++ b/lib/videojs-resolution-switcher.js @@ -337,6 +337,17 @@ }); } + function initResolutionForHLS(player){ + var hls = player.tech_.hls; + + player.one('loadedmetadata', function(){ + var playlists = hls.playlists.master.playlists; + console.log(playlists) + }) + + + } + player.ready(function(){ if(player.options_.sources.length > 1){ // tech: Html5 and Flash @@ -344,6 +355,11 @@ player.updateSrc(player.options_.sources); } + if(player.tech_.hls){ + // HLS support + initResolutionForHLS(player); + } + if(player.techName_ === 'Youtube'){ // tech: YouTube initResolutionForYt(player); diff --git a/package.json b/package.json index aa8ab26..266f77e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "git@github.com:kmoskwiak/videojs-resolution-switcher.git" }, "bugs": { - "url": "https://github.com/kmoskwiak/videojs-resolution-switcher/issues" + "url": "https://github.com/khmoskwiak/videojs-resolution-switcher/issues" }, "license": "Apache-2.0", "keywords": [ @@ -44,7 +44,8 @@ "grunt-contrib-watch": "^1.0", "video.js": "^5.8", "qunitjs": "^1.22", - "videojs-youtube": "^2.0.8" + "videojs-youtube": "^2.0.8", + "videojs-contrib-hls": "^1.3.8" }, "peerDependencies": { "video.js": "^5.8"