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

Video needs fallback when using as an image source #1298

Closed
CircularKen opened this issue Jan 26, 2022 · 5 comments
Closed

Video needs fallback when using as an image source #1298

CircularKen opened this issue Jan 26, 2022 · 5 comments
Labels
status: completed Work completed, can be closed type: false-positive This issue is about valid content being incorrectly rejected
Milestone

Comments

@CircularKen
Copy link

CircularKen commented Jan 26, 2022

I recently created a fixed layout EPUB which contained eight autoplaying videos.

The EPUB was validated with Pagina EPUB-Checker and EPUBCheck 4.2.6

On hearing that the autoplaying videos did not appear on iOS, I found a workaround to use the videos as src on img tags ( more on that technique here) and then adding a method to switch between regular video and the img video only for iOS such as

<div class="videoFrame noniOS" style="left: 0px; top: 0px; height: 842px; width: 595px;"><p><video muted="muted" loop="loop" autoplay="autoplay" playsinline="playsinline" ibooks:pause-readaloud="false" src="video/p6_giraffe_flipped.mp4" poster="images/1px.png" style="height: 842px; width: 595px;"/></p></div>
<div class="videoFrame iOS" style="left: 0px; top: 0px; height: 842px; width: 595px;"><p><img ibooks:pause-readaloud="false" src="video/p6_giraffe_flipped.mp4" style="height: 842px; width: 595px;"/></p></div>

the EPUB now autoplays on iOS and all other devices tested. But… the EPUB is now failing validation 8 times with the same reason
ERROR (MED-003) at "FF001_Triggers_UK_v1.1.epub/OEBPS/1.xhtml" (line 76, col 199): A manifest fallback must be provided for image resource "OEBPS/video/p6_giraffe_flipped.mp4" of type "video/mp4".

I have never seen this request before. No doubt because I have never used the video src for img technique before.
But if I add a fallback to the image resource in the OPF then the autoplaying in iOS no longer works!

This leads me to ask some questions of the group, please…

Q1: Is this epub error intentional?
Q2: Can and should it be altered?
Q3: If I need to add a fallback to a video, why do I only need to do that when it is an image resource?
Q4: Can I add a fallback in a way that doesn't knock out the autoplaying in iOS?

Currently I can only achieve what the client wants by supplying an invalid EPUB… so I'd be happy to hear any advice!

Supplying link and files here with client permission for testing and troubleshooting. Please do not share or use elsewhere…

v1.0 Valid EPUB, not autoplaying video in iOS

Direct download - FF001_Overdrive_UK_v1.0.epub
View online - FF001_Overdrive_UK_v1.0.epub

v1.1 Invalid EPUB, autoplaying video in iOS

Direct download - FF001_Overdrive_UK_v1.1.epub
View online - FF001_Overdrive_UK_v1.1.epub

@mattgarrish
Copy link
Member

The epub spec says that any video resource can be referenced without fallback; nothing restricts where you can reference videos from. So, I'd hazard this is an epubcheck bug.

The rules implemented to handle the various ways you can reference images from picture/img and src/srcset likely wouldn't account for videos, as it's not intuitive that you'd find a video in an img tag.

Adding another rule to sidestep image fallbacks when a video is detected seems a bit unwieldy, but luckily @rdeltour will have to figure that out... 😉

@rdeltour
Copy link
Member

The epub spec says that any video resource can be referenced without fallback;

Yeah, it seems like EPUBCheck is expecting an image/* CMT in an img element, which would be a bug indeed (I'll need to run some tests to double-check).

nothing restricts where you can reference videos from

The host language (HTML, SVG) defines the restrictions.

In that particular case, is it even valid HTML to put some video/mp4 in there? The HTML spec says img represents an image, which can be potentially animated, but including video/mp4 may be a stretch? I remember having seen the article mentioned by @CircularKen (thanks for the pointer!), but didn't really think of EPUB at the time. Interesting question 😊

@rdeltour
Copy link
Member

See whatwg/html#7141

@rdeltour rdeltour added status: in discussion The issue is being discussed by the development team type: spec The issue is related to a Specification update labels Jan 26, 2022
@mattgarrish
Copy link
Member

In that particular case, is it even valid HTML to put some video/mp4 in there?

HTML doesn't restrict the media type, so it's primarily a question of support, no? That's outside our purview.

If there's a valid use case, we shouldn't inject ourselves as the arbiters of whether it makes sense.

@rdeltour
Copy link
Member

Yes I totally agree @mattgarrish!

My question about HTMl validity was mostly out of curiosity. In any case, issuing MED-003 is a bug here.

@rdeltour rdeltour added status: ready for implem The issue is ready to be implemented type: false-positive This issue is about valid content being incorrectly rejected and removed type: spec The issue is related to a Specification update status: in discussion The issue is being discussed by the development team labels Jan 28, 2022
@rdeltour rdeltour added this to the v5.0.0-beta milestone Jan 28, 2022
@rdeltour rdeltour added status: in progress The issue is being implemented by the development team and removed status: ready for implem The issue is ready to be implemented labels Nov 27, 2022
@rdeltour rdeltour added status: completed Work completed, can be closed and removed status: in progress The issue is being implemented by the development team labels Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: completed Work completed, can be closed type: false-positive This issue is about valid content being incorrectly rejected
Projects
None yet
Development

No branches or pull requests

3 participants