-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>lite-youtube-embed - inner</title> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<style> | ||
button { font-size: 200%; } | ||
</style> | ||
</head> | ||
<body> | ||
<h1>video elem inner</h1> | ||
|
||
<div id="videohold"></div> | ||
|
||
<button type="button" onclick="location.reload()">reload this</button> | ||
|
||
<script> | ||
|
||
globalThis.playyy = () => { | ||
document.querySelector('video').play(); | ||
} | ||
|
||
// setTimeout(() => { | ||
document.querySelector('#videohold').innerHTML = ` | ||
<video width="640" height="360" controls autoplay> | ||
<source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4" /><!-- Safari / iOS, IE9 --> | ||
<source src="http://clips.vorwaerts-gmbh.de/VfE.webm" type="video/webm" /><!-- Chrome10+, Ffx4+, Opera10.6+ --> | ||
<source src="http://clips.vorwaerts-gmbh.de/VfE.ogv" type="video/ogg" /><!-- Firefox3.6+ / Opera 10.5+ --> | ||
</video> | ||
`; | ||
playyy(); | ||
// }) | ||
|
||
|
||
</script> | ||
|
||
|
||
|
||
</body> | ||
</html> | ||
|
9dfd33a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If/when you might be ready to pick this back up I have a hunch the issue on iOS / iPad is related to audio volume:
Webkit Policy:
https://webkit.org/blog/6784/new-video-policies-for-ios/#:~:text=elements%20will%20be%20allowed,user%20gesture%2C%20playback%20will%20pause.
Apple dev policy
https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari/
"By default, autoplay executes only if the video doesn’t contain an audio track, or if the video element includes the muted attribute. Video playback pauses if the element gains an audio track, becomes unmuted without user interaction, or if the video is no longer onscreen (either by CSS or due to the user scrolling the page)."
How to repro:
So, it appears this might be bumping up against policy around audio volume (being set to on) when a video starts playing which isn't muted; making this harder than it should be. Hope that's helpful!
proposed a fix: #159
This mutes videos when they are played on an iPad or iPhone. Specifically, it adds the parameter
'mute', '1'
to the video URL if the platform is identified as iPad or iPhone. This is achieved using the test/iPad|iPhone|iPod/.test(navigator.platform)
. The purpose is to mute videos automatically on these devices upon tapping.