I have spent a lot of time this afternoon on this issue and I feel like this issue might not be fixable unless someone else has a brilliant idea.
The problem is in the virtual DOM with prepending (scrolling up). In this case, you are adding a bunch of elements (posts) to the beginning of an array. When the virtual DOM does its diff, it notices the element with the youtube <iframe> is not in the same place, so it removes and re-adds it later. This causes the youtube player to refresh the iframe, which causes it to play again.
It seems impossible to move an <iframe> in the DOM without reloading it.
Note that this bug doesn’t happen when scrolling down because appending posts doesn’t change the order. It also doesn’t matter if the user hasn’t started the video already, because lazyYT hasn’t inserted the iframe yet.
OK our debugging shows that for some reason the Youtube embedded player did fix the autoplay thing, so I am fixing the title here.
The bug we have is that we have “protection” in place when you click play that tells the “post cloaker”, hi … don’t cloak me. But this protection is somehow binned when you scroll up.
This means that if you play a song on youtube and scroll up it will just stop playing when we load the next chunk.
Sorry to resurrect this, but I’ve noticed this starts happening now even when scrolling down. Not sure if something changed this bug recently to the worse, or if it’s a different bug altogether. Confirmed with several people in our instance. This makes video sharing threads quite unbearable, when the earlier videos start suddenly playing.
Appoggio questa tesi, succede sia scorrendo verso l’alto che verso il basso e riproduce casualmente tutti i video riprodotti in precedenza (immagino abbia a che fare con il modo in cui Discourse elabora i contenuti precedenti quando ne carica di nuovi in un argomento, ma onestamente non lo so).
Ho sentimenti contrastanti al riguardo, non credo che le persone debbano aspettarsi che un video di oltre 600 post sopra continui a essere riprodotto mentre scorri all’infinito in un mega-argomento? Il video non è visibile, e non lo è da un po’ se stai scorrendo verso il basso.
ad esempio, se vuoi riprodurre audio per molto tempo mentre navighi, su qualsiasi sito tu stia visitando, aprilo in una nuova scheda?
Secondo me non dovrebbe. Se il video è in pausa o è terminato, non dovrebbe riprodursi da solo solo perché si è scorrevole verso il basso. (Che è il comportamento descritto anche se il titolo è fuorviante)
Infatti, esiste un’alternativa per le persone che vogliono “che la gente continui a giocare” mentre si muovono, se trovano l’approccio a schede troppo complicato.
Questo succede ancora sulla versione stabile 3.0. La cosa divertente è che un video si aggiorna scorrendo VERSO L’ALTO, verso il BASSO rimane in pausa, un altro video casuale fa il contrario. Rimane in pausa scorrendo VERSO L’ALTO e si aggiorna riproducendo scorrendo verso il BASSO.
Non abbiamo ancora implementato alcuna modifica qui.
Il nostro piano è di ricostruire la visualizzazione degli argomenti nel prossimo anno o due, il che dovrebbe migliorare la situazione. Non c’è una soluzione facile qui, ci abbiamo provato.