Youtube - Resumer

Store video.currentTime locally

< Valutazione su Youtube - Resumer

Recensione: Bene - lo script funziona

dr4
§
Pubblicato: 18/11/2023

The script doesn't seem to work anymore

Dry SpoonAutore
§
Pubblicato: 19/11/2023

I think I fixed it. There was an issue finding the video element.

Dry SpoonAutore
§
Pubblicato: 19/11/2023

Never mind, it indeed doesn't work. Before, I just called document.querySelector('video') after a "yt-navigate-finish" event, but it stopped working like a week ago. I changed it to keep trying to find a video:

```
const observer = new MutationObserver((mutations, observer) => {
//Keep trying to find video
let video = document.querySelector('video')
if(video){
listen(video)
observer.disconnect() //video found
}
})

observer.observe(document, {childList:true, subtree:true})
```

Now it seems that the video found isn't the correct one.

Dry SpoonAutore
§
Pubblicato: 19/11/2023

Just tried this and found 2 video elements. Not sure why this happens.

```
let videos = []

const observer = new MutationObserver((mutations, observer) => {
//Keep trying to find video
let video = document.querySelector('video')
if(video){
if(!videos.includes(video)){
videos.push(video)
}
listen(video)
//observer.disconnect() //video found
}
})
```

Dry SpoonAutore
§
Pubblicato: 19/11/2023

Should be fixed. Changed the selector to document.querySelector('video.video-stream').

dr4
§
Pubblicato: 20/11/2023

Fixed, thanks

Pubblica risposta

Accedi per pubblicare una risposta.