mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-24 16:06:34 +00:00
fix(player): an embed without a height shows its film, and heavy films are measured in Safari (#5932)
* test(player): measure heavy films in real Safari and Chrome on macOS * test(player): count runtime media seeks and rate writes during the Safari bench * test(player): compare the Safari bench against native playback of the same media * test(player): split Safari control playback into per-frame media writes and per-frame transforms * perf(core): write media volume and mute only when they change * test(player): presented frame rate and compositor-animation controls in the Safari bench * perf(core): keep the media volume guard without a new comment line * test(player): derive presented frames from playback counters and snapshot video state * test(player): control page plays only listed media, and anchor the Safari process match * test(player): send the bench as code, and write only validated numbers from the browser * fix(player): perf host page gives the player a real box, so films are on screen when measured * fix(player): a player with no height set takes its film's shape instead of collapsing to nothing The player box had no intrinsic height, so an embed that set only a width (or nothing) was 0 px tall and showed no picture. An in-flow sizer now carries the composition's aspect ratio; a height the embed sets still wins, and a height-only embed keeps its full width. * test(player): label each embed on the player box page
This commit is contained in:
@@ -120,6 +120,7 @@ class HyperframesPlayer extends HTMLElement {
|
||||
|
||||
private shadow: ShadowRoot;
|
||||
private container: HTMLDivElement;
|
||||
private readonly sizer = document.createElement("div");
|
||||
private iframe: HTMLIFrameElement;
|
||||
private posterEl: HTMLImageElement | null = null;
|
||||
private controlsApi: ReturnType<typeof setupControls> | null = null;
|
||||
@@ -169,6 +170,8 @@ class HyperframesPlayer extends HTMLElement {
|
||||
|
||||
adoptShadowStyles(this.shadow, PLAYER_STYLES);
|
||||
({ container: this.container, iframe: this.iframe } = createCompositionIframe());
|
||||
this.sizer.className = "hfp-sizer";
|
||||
this.shadow.appendChild(this.sizer);
|
||||
this.shadow.appendChild(this.container);
|
||||
|
||||
const loaderElements = createShaderLoader();
|
||||
@@ -1486,6 +1489,7 @@ class HyperframesPlayer extends HTMLElement {
|
||||
const changed = width !== this._compositionWidth || height !== this._compositionHeight;
|
||||
this._compositionWidth = width;
|
||||
this._compositionHeight = height;
|
||||
this.sizer.style.aspectRatio = `${width} / ${height}`;
|
||||
this._rescale();
|
||||
if (!changed) return;
|
||||
const detail = { compositionWidth: width, compositionHeight: height };
|
||||
|
||||
Reference in New Issue
Block a user