Repository navigation
Ariadne browser video: in the viewport, a read-back ladder, and the box says why there's no picture (untested Android guesses) - #1429
Merged
Conversation
…ox says why there's no picture Joe's Android phone shows nicotina's feed videos as a blank box (arigl-web 4.0.2); desktop Chromium plays them. These are guesses, untested on a phone: - media_browser.cpp: the hidden <video> sits in the viewport's top-left corner (2 px, under the canvas, opacity 0.01) instead of at left -10000px. - A frame is read back with the 2D canvas kept in memory, else WebGL (texImage2D + readPixels, one context per page), else a GPU-backed 2D canvas. A frame that reads back empty or all one colour is tried the other ways (twice a second at most) and the first that gives a picture is kept; until a video has shown one, blank frames aren't published. - A play refused for want of a tap is retried on the next tap or key anywhere on the page. - Loading suspended before any data (preload none, Data Saver) reports ready, so autoplay starts it. - Player::notice() (default ""): what keeps the picture away (tap to start it, frames that come out black and the ways tried, playing with no picture yet). - ariadne.cpp: a video: with no frame says why over its box (item_badge): failed (the error with controls: false), the player's notice, or after 3 s loading or playing, that state. Not with its own badge:, in a box under 96 px, or in a terminal. Docs: ARIADNE.md §5.13. Test: MediaBadge.AVideoWithNoPictureSaysWhyOverItsBox.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Joe's Android phone shows nicotina's feed videos as a blank box on cyberpcangel.com (arigl-web 4.0.2). Desktop Chromium plays them, and so does its Android emulation. The file isn't the problem: H.264 Main 3.1, moov first, and CORS and range requests are fine.
These are untested guesses for Android. There is no device to try them on (no USB debugging right now), so nothing here has run on a phone. Each change is meant to help if it is the cause and do nothing otherwise. If the video still doesn't show, the box now says why, so the phone can tell us without DevTools.
The browser player (
src/cvc/ariadne/media_browser.cpp)The hidden
<video>is in the viewport. It used to sit atleft: -10000px. Now it is in the top-left corner: 2 px,z-index: -1under the canvas, opacity 0.01,pointer-events: none,aria-hidden. A phone's browser may not start or decode a video far outside the viewport (iOS Safari refuses muted autoplay there).Frames are read back through a ladder:
willReadFrequently), as before;texImage2D+readPixels), one context per page;A frame that reads back empty, or all one colour (black, or the green of a zeroed frame), is tried the other ways, at most twice a second. The first way that gives a picture is kept. Until a video has shown a real picture, blank frames aren't published.
willReadFrequently: Chrome moves a 2D canvas that is read back every frame to the CPU after a few readbacks. A GPU-backed 2D canvas alone would change only the first frames. WebGL stays on the GPU.A play refused for want of a tap (
NotAllowedError) is retried on the next tap or key anywhere on the page, inside that gesture. Before, it stayed paused until Play was pressed, and nothing said so.Loading suspended before any data arrived (preload none, as Chrome does on Data Saver and some phones) now reports
ready, soautoplaystarts it. Before, it stayedloadingforever, because autoplay waits forready. A small file fetched whole is also suspended before its metadata; theprogressevent tells the two apart.New
Player::notice()(default"") says what keeps the picture away:tap to start itno CORS: its pictures cannot be readits frames come out black (2d, gl, gpu), with the ways triedplaying, no picture yet (readyState N)Module.cvcMediaPaths(say["gl"]), set before a player opens, picks another order. It is for trying one path.The core (
src/cvc/ariadne/ariadne.cpp)A
video:with no frame says why over its box (item_badge):failed; withcontrols: false, the error itself, since there is no controls line to show it;loading/playing.It isn't shown once a frame has been, where the widget has its own
badge:, in a box under 96 px (avatars, emoji), or in a terminal (where a badge is a line of its own).Docs: §5.13. Test:
MediaBadge.AVideoWithNoPictureSaysWhyOverItsBox.Verified (not on Android)
ariadne_media_test61/61 passed, the new test included. clang-format 18.1.8 is clean.em++ -E, patched into the arigl-web 4.0.2 bundle). The rig: headless Chrome 157 with a D3D11 GPU, emulating a 390x844 phone (DPR 3, touch), running nicotina main against the stub tx.wtf.2d. The element sits at (0,0), 2x2, under the canvas:elementFromPoint(1,1)is the canvas.glorgpuforced, the testsrc frames come out the right way up, in the right colours.2d.its frames come out black (2d, gl, gpu). This turned up WebGL tinting the outer column green on a black frame, so the check now samples a pixel in from the edges.2d, and the late black frames show.tap to start it. A tap anywhere on the page then plays it, with sound.preload=none: the player saysready, and plays on play().preload=autois unaffected (a small file suspends before its metadata too, after aprogress).arigl, the arigl-web shell), on the same rig:2d, with no console errors.Module.cvcMediaPaths = ["bogus"], after 3 s both feed video boxes sayits frames come out empty (bogus none)over the placeholder.Not verified
ari-mediawasn't rebuilt here.