folding – Amazon Santana https://amazonsantana.com Wed, 02 Dec 2026 21:02:42 +0000 en-US hourly 1 https://wordpress.org/?v=7.1.5 https://amazonsantana.com/wp-content/uploads/2025/04/cropped-Gemini_Generated_Image_ddh89kddh89kddh8-32x32.webp folding – Amazon Santana https://amazonsantana.com 32 32 Building a Web Video Player for the iPhone Duo: A Technical Investigation into Folding Screen APIs and Video.js v10 https://amazonsantana.com/building-a-web-video-player-for-the-iphone-duo-a-technical-investigation-into-folding-screen-apis-and-video-js-v10/ https://amazonsantana.com/building-a-web-video-player-for-the-iphone-duo-a-technical-investigation-into-folding-screen-apis-and-video-js-v10/#respond Wed, 02 Dec 2026 21:02:42 +0000 https://amazonsantana.com/building-a-web-video-player-for-the-iphone-duo-a-technical-investigation-into-folding-screen-apis-and-video-js-v10/ The recent release of Video.js version 10.0.0 marks a significant milestone in open-source media playback architecture, coinciding with broader industry developments in hardware design. Following the launch cycle of Apple’s long-anticipated folding device—the iPhone Duo—developers have gained access to advanced hardware simulation tools, specifically within Xcode 27.1 beta. This convergence of a major software library release and next-generation mobile form factors has prompted frontend engineers to investigate how modern web standards adapt to multi-screen and foldable hardware environments.

What the iPhone Duo means for web development | Mux

The Evolution of Mobile Hardware and Web Standards

For over a decade, folding smartphones have remained a fixture of the Android ecosystem, pioneered by manufacturers like Samsung and Google. However, Apple’s entry into the folding market with the iPhone Duo has fundamentally shifted developer priorities across the platform divide. Accompanying the device release, Apple published dedicated technical documentation and developer videos outlining the physical characteristics, device states, and design patterns necessary to build native applications optimized for split-screen and partially folded postures.

While native application ecosystems quickly adapted to these hardware paradigms—exemplified by redesigned layouts from media giants like Netflix—the web development community faced immediate questions regarding feature parity. Historically, web applications running within mobile browsers encounter strict sandboxing and layout limitations compared to native binaries. Nevertheless, the progression of modern web APIs has begun to bridge this gap, introducing granular control mechanisms designed specifically for dual-screen and foldable devices.

What the iPhone Duo means for web development | Mux

Exploring the Device Posture and Viewport Segments APIs

To understand how web content interacts with foldable displays, engineers examining Xcode 27.1’s Device Hub have focused on two critical specifications: the Device Posture API and the Viewport Segments API.

The Device Posture API provides programmatic insight into the physical configuration of the hardware display. Through JavaScript via the navigator.devicePosture property, or via CSS media queries such as @media (device-posture: folded), developers can determine whether a screen is continuous (flat or curved) or folded into specific angles reminiscent of a laptop posture. This distinction allows web applications to dynamically alter their DOM structure based on physical device orientation.

What the iPhone Duo means for web development | Mux

Complementing posture detection, the Viewport Segments API details the individual regions or segments created by hardware hinges. In JavaScript, window.viewport.segments yields an array of DOMRect objects defining the precise size, shape, and coordinates of each display segment. In CSS, developers can leverage media queries like horizontal-viewport-segments and vertical-viewport-segments, alongside CSS environment variables such as env(viewport-segment-width), to align grid layouts precisely with physical screen boundaries.

Implementing these variables in production requires meticulous calculation to prevent content from spilling across the physical crease of the device. For example, a two-column layout can be adapted to snap directly to individual display segments when the device is folded:

What the iPhone Duo means for web development | Mux
.layout 
    display: grid;
    grid-template-columns: 1fr 2fr;


@media (horizontal-viewport-segments: 2) 
    .layout 
        grid-template-columns:
            env(viewport-segment-width 0 0)
            env(viewport-segment-width 1 0);

        /* Accounting for the physical hinge gap */
        column-gap: calc(
          env(viewport-segment-left 1 0) - 
          env(viewport-segment-right 0 0)
        );
    

This approach ensures that user interface elements respect the physical divisions of the hardware, preventing visual distortion around the hinge.

Testing Multi-Screen Video Layouts with Video.js

The architectural overhaul introduced in Video.js 10.0.0 relies on a modular, component-driven design that simplifies custom skinning and layout manipulation. Inspired by native implementations—where a partially folded media player allocates the video stream to the top display segment and places expansive playback controls on the bottom segment—developers sought to replicate this layout within web browsers.

What the iPhone Duo means for web development | Mux

Achieving a true split-screen media layout on iOS Safari, however, presents substantial technical hurdles. By default, iOS restricts custom web elements from utilizing native fullscreen capabilities in certain configurations, often forcing developers to rely on system-level video controls. By activating experimental feature flags within the WebKit environment—specifically enabling the Fullscreen API—engineers were able to override these restrictions and deploy custom Video.js components into a full-viewport container.

To recreate a Netflix-style interface, developers utilized custom skins and HTML templates to partition the screen. Below the primary video container, a secondary control deck was introduced via CSS positioning tied directly to the Viewport Segments environment variables:

What the iPhone Duo means for web development | Mux
.duo-controls 
    display: none;


@media (device-posture: folded) and (vertical-viewport-segments: 2) 
    .video-skin:fullscreen > :is(video, .media-poster, .media-buffering-indicator, .video-status-indicators) 
      position: absolute;
      inset-inline: 0;
      top: env(viewport-segment-top 0 0);
      height: env(viewport-segment-height 0 0);
    

    .video-skin:fullscreen :is(media-controls, .media-title) 
      display: none;
    

    .video-skin:fullscreen .duo-controls 
      display: flex;
      position: absolute;
      inset-inline: 0;
      top: env(viewport-segment-top 0 1);
      bottom: 0;
    

Implementing Ambient Visual Reflections

Beyond structural layout adjustments, advanced media players often incorporate aesthetic flourishes to enhance user immersion. Replicating the ambient reflection effect seen in native applications—where the lower screen reflects a blurred, color-matched glow from the video feed—required a combination of HTML5 Canvas rendering and CSS manipulation.

Because standard properties like -webkit-box-reflect fail to render live <video> elements consistently on mobile Safari, developers implemented a frame-capture loop using the requestVideoFrameCallback API:

What the iPhone Duo means for web development | Mux
const video = document.querySelector('video');
const canvas = document.querySelector('.duo-reflection');
const context = canvas.getContext('2d');

function draw() 
    canvas.width = 160;
    canvas.height = 160 * (video.videoHeight / video.videoWidth);
    context.drawImage(video, 0, 0, canvas.width, canvas.height);


video.requestVideoFrameCallback(function onFrame() 
    draw();
    video.requestVideoFrameCallback(onFrame);
);

video.addEventListener('seeked', draw);

By downscaling each video frame onto an offscreen canvas, applying a vertical scale inversion, heavy CSS blurring, and a linear gradient mask, engineers successfully generated a soft ambient glow positioned directly behind the control panel on the lower screen segment:

.duo-controls 
  isolation: isolate; 


.duo-reflection 
  position: absolute;
  inset: 0;
  z-index: -1;            
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom;

  scale: 1 -1;            
  filter: blur(24px);     
  opacity: 0.35;
  mask-image: linear-gradient(to top, black, transparent 80%); 

Cross-Platform Compatibility and Browser Limitations

Despite successful emulation within experimental WebKit configurations, broader cross-platform testing reveals persistent limitations in how browser engines handle fullscreen requests on foldable hardware.

What the iPhone Duo means for web development | Mux

When attempting identical implementations on Android-based foldable hardware—such as the Pixel 9 Pro Fold running Chromium—results indicate that browser security models and window management policies restrict fullscreen video elements exclusively to the primary screen segment. Even when CSS media queries accurately report device posture and viewport segments, the lower screen region remains clipped or inaccessible for web-based fullscreen media playback due to intentional upstream rendering constraints.

Consequently, while advanced web APIs provide the necessary telemetry to detect foldable states, achieving complete parity with native multi-window application layouts remains restricted by browser-level sandboxing. Nevertheless, the introduction of Video.js 10.0.0 demonstrates the increasing flexibility of modern frontend media architectures, empowering developers to prototype and deploy complex layout adaptations as web standards continue to evolve alongside cutting-edge mobile hardware.

]]>
https://amazonsantana.com/building-a-web-video-player-for-the-iphone-duo-a-technical-investigation-into-folding-screen-apis-and-video-js-v10/feed/ 0