문제

YouTube web version can always play a video automatically on mobile Safari without a user's explicit action to the HTML video element. How does YouTube do this?

도움이 되었습니까?

해결책

YouTube's actually done something quite tricky, if you click a video related to the current one or in the search, it doesn't actually load another page, it uses JavaScript to update the page to look like a different one, and then uses that same click handler to start the video, so the system thinks that it was user initiated. That's why if you enter the URL for a video straight into the address bar when not in YouTube it doesn't auto-start...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top