-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2090 from tf/ios-17-video-bug
Add workaround for video scaling issue in iOS 17 below 17.4
- Loading branch information
Showing
8 changed files
with
153 additions
and
10 deletions.
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
Binary file added
BIN
+4.8 KB
...es/scrolled/package/src/frontend/__stories__/browserBugs/safariVideoDimension/100x100.mp4
Binary file not shown.
Binary file added
BIN
+4.93 KB
...es/scrolled/package/src/frontend/__stories__/browserBugs/safariVideoDimension/200x100.mp4
Binary file not shown.
71 changes: 71 additions & 0 deletions
71
...pes/scrolled/package/src/frontend/__stories__/browserBugs/safariVideoDimension/stories.js
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,71 @@ | ||
import React from 'react'; | ||
|
||
import squareVideo from './100x100.mp4'; | ||
import landscapeVideo from './200x100.mp4'; | ||
|
||
export default { | ||
title: 'Frontend/Browser Bugs', | ||
parameters: { | ||
percy: {skip: true} | ||
} | ||
} | ||
|
||
export const safariVideoDimension = () => ( | ||
<div> | ||
<style> | ||
{` | ||
.wr {width: 300px; height: 300px; } | ||
.wr > div, | ||
.video-js { height: 100%; } | ||
video { | ||
border: solid 1px red; | ||
} | ||
`}` | ||
</style> | ||
<p> | ||
Load video 1, release it, load video 2. Observe the video being scaled | ||
down to only cover parts of the upper part of the video element. | ||
</p> | ||
<div className="wr" id="container"></div> | ||
<button onClick={() => loadVideo(0)}>Load video 1</button> | ||
<button onClick={() => loadVideo(1)}>Load video 2</button> | ||
<button onClick={() => release()}>Release</button> | ||
</div> | ||
); | ||
|
||
const srcs = [ | ||
landscapeVideo, | ||
squareVideo | ||
]; | ||
|
||
let video; | ||
|
||
function loadVideo(i) { | ||
if (!video) { | ||
video = document.createElement('video'); | ||
video.setAttribute('crossorigin', 'anonymous'); | ||
video.setAttribute('playsinline', true); | ||
video.setAttribute('loop', true); | ||
video.setAttribute('class', 'video-js wr'); | ||
} | ||
|
||
video.src = srcs[i]; | ||
|
||
// Uncomment to fix | ||
// video.load(); | ||
|
||
document.getElementById('container').appendChild(video); | ||
|
||
setTimeout(() => { | ||
video.play(); | ||
}, 1000); | ||
} | ||
|
||
function release() { | ||
if (video) { | ||
video.pause(); | ||
|
||
document.getElementById('container').removeChild(video); | ||
} | ||
} |
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
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