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.
Eu também, acontece ao rolar para cima ou para baixo e reproduz aleatoriamente todos os vídeos reproduzidos anteriormente (imagino que tenha algo a ver com a forma como o Discourse processa o conteúdo anterior ao carregar novo em um Tópico, mas honestamente não sei).
Tenho sentimentos mistos sobre isso, não acho que as pessoas devam ter a expectativa de que um vídeo de mais de 600 posts acima continue tocando enquanto você rola infinitamente em um mega-tópico? O vídeo não está visível e não está visível há algum tempo se você estiver rolando para baixo.
por exemplo, se você quiser tocar áudio por um longo tempo enquanto navega, em qualquer site que esteja visitando, abra-o em uma nova aba?
Na minha opinião, não deveria. Se o vídeo está pausado ou terminou, ele não deveria voltar a tocar sozinho só porque você rolou a página para baixo. (Que é o comportamento descrito, mesmo que o título seja enganoso)
Na verdade, existe uma alternativa para as pessoas que querem “que as pessoas continuem a jogar” enquanto você navega, se acharem a abordagem de abas demais.
Isso ainda acontece na versão estável 3.0. O engraçado é que um vídeo é atualizado ao rolar para CIMA, ao rolar para BAIXO ele continua pausado, outro vídeo aleatório faz o oposto. Permanece pausado ao rolar para CIMA e atualiza a reprodução ao rolar para BAIXO.
Nosso plano é reconstruir nossa visualização de tópicos nos próximos 1 ou 2 anos, o que esperamos que melhore a situação. Não há uma solução fácil aqui, nós tentamos.