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.
أتفق مع هذا، يحدث ذلك سواء عند التمرير لأعلى أو لأسفل ويعيد تشغيل جميع مقاطع الفيديو التي تم تشغيلها مسبقًا بشكل عشوائي (أتخيل أن الأمر يتعلق بكيفية معالجة Discourse للمحتوى السابق عند تحميل محتوى جديد في موضوع، ولكن بصراحة لا أعرف).
لدي مشاعر مختلطة حيال هذا، لا أعتقد أنه يجب أن يكون لدى الناس توقع بأن مقطع فيديو من 600+ منشور أعلاه سيستمر في التشغيل أثناء التمرير لأسفل بلا نهاية في موضوع ضخم؟ الفيديو غير مرئي، ولم يكن مرئيًا لفترة من الوقت إذا كنت تمرر لأسفل.
على سبيل المثال، إذا كنت ترغب في تشغيل الصوت لفترة طويلة أثناء تصفحك، على أي موقع تزوره، افتحه في علامة تبويب جديدة؟
لا ينبغي ذلك، في رأيي. إذا تم إيقاف الفيديو مؤقتًا أو انتهى، فلا ينبغي إعادة تشغيله تلقائيًا بمجرد التمرير لأسفل. (وهو السلوك الموصوف على الرغم من أن العنوان مضلل)
في الواقع، هناك بديل للأشخاص الذين يريدون “أن يستمر الناس في اللعب” أثناء تنقلك، إذا وجدوا نهج علامات التبويب مفرطًا.
لا يزال هذا يحدث في الإصدار المستقر 3.0. الشيء المضحك هو أن مقطع فيديو واحد يتم تحديثه عند التمرير لأعلى، وعند التمرير لأسفل لا يزال متوقفًا مؤقتًا، ومقطع فيديو عشوائي آخر يفعل العكس. يبقى متوقفًا مؤقتًا عند التمرير لأعلى ويتم تحديث التشغيل عند التمرير لأسفل.