peertube-theme-nctv-dark/peertube-plugin-hello-world/client/video-watch-client-plugin.js

53 lines
1.1 KiB
JavaScript
Raw Normal View History

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',
handler: () => 'video loaded'
})
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
}
})
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
}
})
2019-07-16 09:53:38 +00:00
}
export {
register
}