Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Move clips to iframe #2778

Merged
merged 3 commits into from
Sep 11, 2024
Merged
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
23 changes: 12 additions & 11 deletions src/backend/effects/builtin/clips.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const clip = {
}

webServer.sendToOverlay("playTwitchClip", {
clipSlug: clip.id,
clipVideoUrl: clip.embedUrl,
width: effect.width,
height: effect.height,
duration: clipDuration,
Expand Down Expand Up @@ -277,18 +277,19 @@ const clip = {
rotation
} = event;

const styles = (width ? `width: ${width}px;` : '') +
(height ? `height: ${height}px;` : '') +
(rotation ? `transform: rotate(${rotation});` : '');
// eslint-disable-next-line prefer-template
const styles = `width: ${width || screen.width}px;
height: ${height || screen.height}px;
transform: rotate(${rotation || 0});`;

const videoElement = `
<video autoplay
src="${clipVideoUrl}"
height="${height || ""}"
width="${width || ""}"
style="border: none;${styles}"
onloadstart="this.volume=${volume}"
allowfullscreen="false" />
<iframe style="border: none; ${styles}"
src="${clipVideoUrl}&parent=${window.location.hostname}&autoplay=true"
height="${height || screen.height}"
width="${width || screen.width}"
frameBorder=0
allowfullscreen>
</iframe>
`;

const positionData = {
Expand Down
5 changes: 3 additions & 2 deletions src/backend/effects/builtin/play-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const playVideo = {
</eos-container>
</div>

<eos-container header="Volume" pad-top="true">
<eos-container ng-if="effect.videoType != 'Random Twitch Clip' && effect.videoType != 'Twitch Clip'" header="Volume" pad-top="true">
<div class="volume-slider-wrapper">
<i class="fal fa-volume-down volume-low"></i>
<rzslider rz-slider-model="effect.volume" rz-slider-options="{floor: 0, ceil: 10, hideLimitLabels: true}"></rzslider>
Expand Down Expand Up @@ -486,7 +486,8 @@ const playVideo = {
}
}

const clipVideoUrl = `${clip.thumbnailUrl.split("-preview-")[0]}.mp4`;
//const clipVideoUrl = `${clip.thumbnailUrl.split("-preview-")[0]}.mp4`;
const clipVideoUrl = clip.embedUrl;
const clipDuration = clip.duration;
const volume = parseInt(effect.volume) / 10;

Expand Down
Loading