Using new placeholder. WIP.
This commit is contained in:
parent
2d3726a087
commit
5b7f247af3
@ -178,12 +178,16 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
|
|||||||
logger.error('No video provided')
|
logger.error('No video provided')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const videoWrapper = document.querySelector('#video-wrapper')
|
// Peertube >= 3.2.0 provide #plugin-placeholder-player-next
|
||||||
if (!videoWrapper) {
|
const placeholder =
|
||||||
logger.error('The required div is not present in the DOM.')
|
document.getElementById('plugin-placeholder-player-next') ??
|
||||||
|
document.getElementById('video-wrapper')
|
||||||
|
if (!placeholder) {
|
||||||
|
logger.error('The required placeholder div is not present in the DOM.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let container = videoWrapper.querySelector('#peertube-plugin-livechat-container')
|
|
||||||
|
let container = placeholder.querySelector('#peertube-plugin-livechat-container')
|
||||||
if (container) {
|
if (container) {
|
||||||
logger.log('The chat seems already initialized...')
|
logger.log('The chat seems already initialized...')
|
||||||
return
|
return
|
||||||
@ -191,7 +195,7 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
|
|||||||
container = document.createElement('div')
|
container = document.createElement('div')
|
||||||
container.setAttribute('id', 'peertube-plugin-livechat-container')
|
container.setAttribute('id', 'peertube-plugin-livechat-container')
|
||||||
container.setAttribute('peertube-plugin-livechat-state', 'initializing')
|
container.setAttribute('peertube-plugin-livechat-state', 'initializing')
|
||||||
videoWrapper.append(container)
|
placeholder.append(container)
|
||||||
|
|
||||||
peertubeHelpers.getSettings().then((s: any) => {
|
peertubeHelpers.getSettings().then((s: any) => {
|
||||||
settings = s
|
settings = s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user