Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/bloom-player-content.less
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@
.bloom-canvas .bloom-imageContainer[data-href] {
z-index: @canvasElementCanvasZIndex + 1 !important;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should really go in bloom-player-ui.less instead. But then would I set @canvasElementCanvasZIndex there too? Or just set it to a really high number?

// Detector with z-index above canvas so we can detect clicks of playback controls
.videoMouseDetector {
height: 100%;
width: 100%;
position: absolute;
top: 0;
z-index: @canvasElementCanvasZIndex + 1;
}
}
@media (hover: hover) {
.bloomPlayer .bloom-canvas .bloom-imageContainer[data-href]:hover {
Expand Down
13 changes: 8 additions & 5 deletions src/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Video {
// configure one of the icons we display over videos. We put a div around it and apply
// various classes and append it to the parent of the video.
private wrapVideoIcon(
videoElement: HTMLVideoElement,
parent: HTMLElement,
icon: HTMLElement,
iconClass: string,
): HTMLElement {
Expand All @@ -43,7 +43,7 @@ export class Video {
wrapper.appendChild(icon);
wrapper.classList.add(iconClass);
icon.classList.add("videoControl");
videoElement.parentElement?.appendChild(wrapper);
parent.appendChild(wrapper);
return icon;
}

Expand Down Expand Up @@ -75,9 +75,12 @@ export class Video {
}
this.getVideoElements().forEach((videoElement) => {
videoElement.removeAttribute("controls");
videoElement.addEventListener("click", this.handleVideoClick);
const mouseDetector = document.createElement("div");
mouseDetector.classList.add("videoMouseDetector");
mouseDetector.addEventListener("click", this.handleVideoClick);
videoElement.parentElement?.appendChild(mouseDetector);
const playButton = this.wrapVideoIcon(
videoElement,
mouseDetector,
// Alternatively, we could import the Material UI icon, make this file a TSX, and use
// ReactDom.render to render the icon into the div. But just creating the SVG
// ourselves (as these methods do) seems more natural to me. We would not be using
Expand All @@ -88,7 +91,7 @@ export class Video {
);
playButton.addEventListener("click", this.handlePlayClick);
const replayButton = this.wrapVideoIcon(
videoElement,
mouseDetector,
getReplayIcon("#ffffff"),
"videoReplayIcon",
);
Expand Down