移动YouTube网页如何在iOS上自动播放视频? [英] How mobile YouTube page autoplay videos on iOS?

查看:324
本文介绍了移动YouTube网页如何在iOS上自动播放视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让它理解,但经过2天的挖掘代码后,我认为我会在这里发布我的问题...

I'm trying to get it understand but after 2 days of digging the code I thought that I will post my issue here...

根据Apple的文档如果没有用户交互,首先在iOS设备上自动播放视频(例如点按视频)。尽管如此,移动YouTube(m.youtube.com)能够在加载带有视频的页面后自动播放其视频。

According to Apple's documentation, autoplaying videos on iOS devices cannot be done without user interaction first (e.g. tap on video). Despite that, mobile YouTube (m.youtube.com) is able to autoplay its videos just after loading a page with video.

有谁知道他们是怎么做的?

Does anyone know how they are doing it?

PS。我已经检查了iOS上网站上自动播放视频的所有可用JS / HTML技术(例如iframe,虚假点击,触发视频触摸事件,使用XHR获取视频)。

PS. I've checked all available JS/HTML techniques of autoplaying videos on website on iOS (e.g. iframe, fake click, triggering touch event on video, fetching video with XHR).

推荐答案

我相信youtube.com是一个单页应用。因此,当用户点击列表视图中的视频时,页面未加载,并且他们的javascript使用初始点击,这会导致视频页面,即启动视频的点击。它实际上不是自动播放,这只是一个技巧。

I believe that youtube.com is a single page app. So when the user clicks on the video from the list view the page is not loading and their javascript uses that initial click, that leads to the video page, as the click that starts the video. It's not actually autoplaying, it's just a trick.

这篇关于移动YouTube网页如何在iOS上自动播放视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆