Skip to content

Commit

Permalink
fix expand mode video on safari
Browse files Browse the repository at this point in the history
  • Loading branch information
noam-heller1 committed Feb 20, 2024
1 parent 2f19423 commit b019513
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/gallery/src/components/item/videos/videoItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ class VideoItem extends React.Component {
try {
const { shouldPlay } = props;
if (shouldPlay && !this.isPlaying) {
this.videoElement = this.videoElement || window.document.querySelector(`#video-${this.props.id} video`);
this.videoElement =
this.videoElement || window.document.querySelector(`#video-${this.props.id}-${this.props.galleryId} video`);
if (this.videoElement) {
this.isPlaying = true;
this.videoElement.play();
Expand Down Expand Up @@ -154,7 +155,7 @@ class VideoItem extends React.Component {
<PlayerElement
playsinline
className={'gallery-item-visible video gallery-item'}
id={`video-${this.props.id}`}
id={`video-${this.props.id}-${this.props.galleryId}`}
width="100%"
height="100%"
url={url}
Expand Down Expand Up @@ -212,7 +213,8 @@ class VideoItem extends React.Component {

fixIFrameTabIndexIfNeeded() {
if (this.props.isExternalVideo) {
const videoGalleryItem = window.document && window.document.getElementById(`video-${this.props.id}`);
const videoGalleryItem =
window.document && window.document.getElementById(`video-${this.props.id}-${this.props.galleryId}`);
const videoIFrames = videoGalleryItem && videoGalleryItem.getElementsByTagName('iframe');
const videoIFrame = videoIFrames && videoIFrames[0];
if (videoIFrame) {
Expand Down

0 comments on commit b019513

Please sign in to comment.