diff --git a/bin/build-player.js b/bin/build-player.js
index bf438866..cf2fc78d 100755
--- a/bin/build-player.js
+++ b/bin/build-player.js
@@ -24,6 +24,7 @@ var order = [
'twitchclip.coffee',
'peertube.coffee',
'iframechild.coffee',
+ 'odysee.coffee',
'update.coffee'
];
diff --git a/player/odysee.coffee b/player/odysee.coffee
new file mode 100644
index 00000000..3babd3b8
--- /dev/null
+++ b/player/odysee.coffee
@@ -0,0 +1,80 @@
+window.OdyseePlayer = class OdyseePlayer extends Player
+ constructor: (data) ->
+ if not (this instanceof OdyseePlayer)
+ return new OdyseePlayer(data)
+
+ @load(data)
+
+ load: (data) ->
+ @setMediaProperties(data)
+ @ready = false
+
+ waitUntilDefined(window, 'playerjs', =>
+ iframe = $('')
+ .attr(
+ src: data.meta.embed.src
+ allow: 'autoplay; fullscreen'
+ )
+
+ removeOld(iframe)
+
+ @player = new playerjs.Player(iframe[0])
+ @player.on('ready', =>
+ @player.on('error', (error) =>
+ console.error('PlayerJS error', error.stack)
+ )
+ @player.on('ended', ->
+ if CLIENT.leader
+ socket.emit('playNext')
+ )
+ @player.on('play', ->
+ @paused = false
+ if CLIENT.leader
+ sendVideoUpdate()
+ )
+ @player.on('pause', ->
+ @paused = true
+ if CLIENT.leader
+ sendVideoUpdate()
+ )
+
+ @player.setVolume(VOLUME * 100)
+
+ if not @paused
+ @player.play()
+
+ @ready = true
+ )
+ )
+
+ play: ->
+ @paused = false
+ if @player and @ready
+ @player.play()
+
+ pause: ->
+ @paused = true
+ if @player and @ready
+ @player.pause()
+
+ seekTo: (time) ->
+ if @player and @ready
+ @player.setCurrentTime(time)
+
+ setVolume: (volume) ->
+ if @player and @ready
+ @player.setVolume(volume * 100)
+
+ getTime: (cb) ->
+ if @player and @ready
+ @player.getCurrentTime(cb)
+ else
+ cb(0)
+
+ getVolume: (cb) ->
+ if @player and @ready
+ @player.getVolume((volume) ->
+ cb(volume / 100)
+ )
+ else
+ cb(VOLUME)
diff --git a/player/update.coffee b/player/update.coffee
index 1586c6af..5b4a3dc2 100644
--- a/player/update.coffee
+++ b/player/update.coffee
@@ -17,6 +17,7 @@ TYPE_MAP =
pt: PeerPlayer
bc: IframeChild
bn: IframeChild
+ od: OdyseePlayer
window.loadMediaPlayer = (data) ->
try
diff --git a/src/get-info.js b/src/get-info.js
index 5d2c0f89..2739a447 100644
--- a/src/get-info.js
+++ b/src/get-info.js
@@ -6,6 +6,7 @@ const ffmpeg = require("./ffmpeg");
const mediaquery = require("@cytube/mediaquery");
const YouTube = require("@cytube/mediaquery/lib/provider/youtube");
const Vimeo = require("@cytube/mediaquery/lib/provider/vimeo");
+const Odysee = require("@cytube/mediaquery/lib/provider/odysee");
const PeerTube = require("@cytube/mediaquery/lib/provider/peertube");
const BitChute = require("@cytube/mediaquery/lib/provider/bitchute");
const BandCamp = require("@cytube/mediaquery/lib/provider/bandcamp");
@@ -397,6 +398,16 @@ var Getters = {
});
},
+ /* Odysee */
+ od: function (id, callback) {
+ Odysee.lookup(id).then(video => {
+ video = new Media(video.id, video.title, video.duration, "od", video.meta);
+ callback(null, video);
+ }).catch(error => {
+ callback(error.message || error);
+ });
+ },
+
/* BandCamp */
bn: function (id, callback) {
BandCamp.lookup(id).then(video => {
diff --git a/src/utilities.js b/src/utilities.js
index 42c11f2b..c5ed5264 100644
--- a/src/utilities.js
+++ b/src/utilities.js
@@ -213,6 +213,9 @@
case "bn":
const [artist,track] = id.split(';');
return `https://${artist}.bandcamp.com/track/${track}`;
+ case "od":
+ const [user,video] = id.split(';');
+ return `https://odysee.com/@${user}/${video}`;
default:
return "";
}
diff --git a/www/js/util.js b/www/js/util.js
index f3e9c5e4..aeef49e7 100644
--- a/www/js/util.js
+++ b/www/js/util.js
@@ -64,6 +64,9 @@ function formatURL(data) {
case "bn":
const [artist,track] = data.id.split(';');
return `https://${artist}.bandcamp.com/track/${track}`;
+ case "od":
+ const [user,video] = data.id.split(';');
+ return `https://odysee.com/@${user}/${video}`;
default:
return "#";
}
@@ -1403,6 +1406,12 @@ function parseMediaLink(url) {
return { type: 'bc', id: `${data.pathname.slice(7).split('/').shift()}` }
}
+ case 'odysee.com':
+ const format = new RegExp('/@(?[^:]+)(?::\\w)?/(?