2019-07-16 09:53:38 +00:00
|
|
|
function register ({ registerHook, peertubeHelpers }) {
|
|
|
|
registerHook({
|
2019-07-22 12:08:20 +00:00
|
|
|
target: 'action:video-watch.init',
|
2019-07-16 09:53:38 +00:00
|
|
|
handler: () => console.log('Hello video watch world')
|
|
|
|
})
|
2019-07-22 13:38:26 +00:00
|
|
|
|
|
|
|
registerHook({
|
|
|
|
target: 'action:video-watch.video.loaded',
|
2021-04-09 13:19:32 +00:00
|
|
|
handler: ({ videojs, video, playlist }) => {
|
|
|
|
|
|
|
|
if (playlist) {
|
|
|
|
console.log('playlist loaded')
|
|
|
|
} else {
|
|
|
|
console.log('video loaded')
|
|
|
|
}
|
|
|
|
}
|
2019-07-22 13:38:26 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
registerHook({
|
|
|
|
target: 'filter:api.video-watch.video.get.result',
|
|
|
|
handler: video => {
|
|
|
|
video.name += ' \o/'
|
|
|
|
|
|
|
|
return video
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
registerHook({
|
|
|
|
target: 'filter:api.video-watch.video-threads.list.result',
|
|
|
|
handler: result => {
|
2019-07-22 14:40:52 +00:00
|
|
|
result.data.forEach(c => c.text += ' THREAD')
|
2019-07-22 13:38:26 +00:00
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
registerHook({
|
|
|
|
target: 'filter:api.video-watch.video-thread-replies.list.result',
|
|
|
|
handler: result => {
|
|
|
|
result.children.forEach(c => c.comment.text += ' REPLY DEEP 1')
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
})
|
2019-12-05 16:08:33 +00:00
|
|
|
|
|
|
|
registerHook({
|
|
|
|
target: 'filter:internal.video-watch.player.build-options.result',
|
|
|
|
handler: (result, params) => {
|
|
|
|
console.log('Running player build options hook for video %s.', params.video.name)
|
|
|
|
result.playerOptions.common.inactivityTimeout = 10000
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
})
|
2020-04-15 14:13:04 +00:00
|
|
|
|
|
|
|
peertubeHelpers.notifier.info('you are on the watch page', 'useless', 1000)
|
2021-04-12 09:10:40 +00:00
|
|
|
|
|
|
|
// Insert element next to the player
|
|
|
|
{
|
|
|
|
const elem = document.createElement('div')
|
|
|
|
elem.className = 'hello-world-h4'
|
|
|
|
elem.innerHTML = '<h4>Hello everybody! This is an element next to the player</h4>'
|
|
|
|
|
|
|
|
document.getElementById('plugin-placeholder-player-next').appendChild(elem)
|
|
|
|
}
|
2019-07-16 09:53:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
register
|
|
|
|
}
|