Open dauwhe opened 6 years ago
Some few further details.
In practice Reading Systems might be wary of handling exceptions like Youtube/Vimeo/etc., given the current handling methods, which vary from:
I guess 1. and 2. for security (and political) reasons.
Personally, I'd like to see external content beyond video streaming allowed, such as interactive HTML widgets. Some widgets that can work locally can already be supported in FL EPUB3 but there would be great value to see support for streaming IN content from outside of the book (so quiz content can be kept topical) and also to allow to post OUT to a reporting system (so quiz answers can be analysed).
Should it fall into Remote Resources (or any problem with treating iframe as Remote Resources)?
Examples of resources that are not Publication Resources include those identified by the Package Document link [Packages32] element and those identified in outbound hyperlinks that resolve to Remote Resources (e.g., referenced from the href attribute of an [HTML] a element).
Made a very minimal sample EPUB with an iframe pointing to an external website, and tried it with some reading systems:
Pretty hard to offline this content too. I don't think we should bite this off for 3.2.
CG resolved to defer this to the next version of EPUB. The implications for the user experience, security, IP, etc. are profound. We need to get all our 🦆s in a row.
From web browser point of view I know iframe and a (href to outside) are different, but from internal resource or external resource point of view (which reading system more care about) I can not see much difference between iframe and a (href to external resource of epub)
Also, offline reading (which is one of major use case of epub) is one of my biggest concern. As reading system we can not cache or prefetch external resource and also need to let user know exactly some specific part of content can not be displayed is because of they are offline.
To be clear, what we are saying here is that in a timeframe where we are trying to encourage greater and greater adoption of EPUB, and the tools used to create it, if someone (say, a teacher creating a course syllabus) inserts a link to a youtube video, our stance is that should not be allowed in the spec, and should fail EPUBcheck, and not be encouraged or even supported by a reading system?
That should fail epubcheck, as it being a foreign resource isn't the primary problem but that you're not allowed to reference resources outside the container except in a few cases:
All Publication Resources must be located in the EPUB Container, with the following exceptions:
- Audio resources [Core Media Types] may be located outside the EPUB Container.
- Video resources may be located outside the EPUB Container.
- Resources retrieved by scripts may be located outside the EPUB Container, but the [HTML] and [SVG] script elements must not reference Remote Resources to ensure availability at runtime (i.e., from their src or href attributes, respectively).
- Font resources may be located outside the EPUB Container.
There is a danger that we throw the format out the window to let html content in (rules, meh, I'll just iframe it!). But in the interests of happy mediums, is there any way to find consensus around this as a remote video issue? I don't think the specification should dive into whitelisting video sites, but what if we had a statement like:
Authors MAY reference remote videos hosted by content distribution services such as YouTube and Vimeo from an iframe element [HTML] (i.e., that do not have a video media type), but Reading Systems MAY ignore such references.
And to that add an additional clarification that it is up to reading system vendors to determine what sites they will allow references to, if any. Probably in the section I cited above.
A toe in the door kind of approach, maybe?
@mattgarrish see #252. I think we have some contradictory language in our specs :)
(GitHub doesn't allow EPUBs as attachements; changed extension to ZIP)
Not sure I'm following.
A foreign resource isn't a remote resource, it's just one that isn't a core media type. You need to provide a fallback for foreign resources from an iframe using maifest fallbacks, yes, but that doesn't mean you can use an iframe to reference web-hosted content.
Looks like epubcheck is wrong here?
Deleted my example above. It appears to be a bug in epubcheck, and confusion between "foreign" and "remote."
An additional datapoint for @dauwhe's list. Tried his sample in the Readium Chrome app and it failed with these errors:
The source list for Content Security Policy directive 'script-src' contains an invalid source: ''wasm-eval''. It will be ignored.
content_001.xhtml:12 Refused to frame 'https://www.youtube.com/' because it violates the following Content Security Policy directive: "frame-src 'self' blob: filesystem: data: chrome-extension-resource:".
This isn't too surprising as Chrome is rather restrictive about security rules with respect to Chrome Extensions and Apps. Alternatively, I tried the sample in the Readium CloudReader (0.31-alpha) and it appears to work fine.
Filed a bug on epubcheck https://github.com/IDPF/epubcheck/issues/852
This is both an interesting hack, and a possible way forward. In general EPUB uses fallbacks when content might not be available to a particular user. This is a similar situation, except rather than being a different media type the resource is remote.
The issue was discussed in a meeting on 2020-12-11)
I am a supporter of allowing External Content in EPUB.
Maybe we should have a way to declare to the reading system, from within the EPUB metadata, which external links we want to allow in the page content?
A reading system could then choose how to flag this potential security risk to the user and give options whether to allow this external content? Maybe based on an allowed or disallowed list?
There are great things that an offline EPUB will never be able to achieve but I would argue should be supported and allowed within EPUB.
Here is a video clip of Sketchfab 3D model working in a fixed layout EPUB in Thorium. https://www.youtube.com/watch?v=P_PMLeqbbjQ
Here is video clip of legally streaming original music from Spotify into an EPUB using Readium on the web. https://youtu.be/0j-HC_4M2sA?t=932
Also the communication from a book out from the EPUB to a cloud based service has great potential and I would recommend this is also be supported or at least not disallowed.
Here is a video clip of BookWidgets student quiz results being sent to a marking system from Thorium https://www.youtube.com/watch?v=x9Np1CDjLFI
Looking up this thread I was pleased to see I said something similar on 5 Jul 2018 and I still agree with myself.
The issue was discussed in a meeting on 2021-05-27
The issue was discussed in a meeting on 2021-10-08
Which demands with this issue?
(a) to use the video from foreign resource (b) to use 'iframe' (c) to use embeded 'YouTube'
If (a) , no need to use iframe. If (c), I think as follows;
YouTube URLs are not immutable. The URL changes if the video is updated. And advertisements may be displayed. Then, AFTER distributing EPUB, the following problems can occur.
If it's a website, we can fix it quickly, but it's difficult to fix it with EPUB that has already been distributed. Simple links are less risky.
The question seems to be, is an iframe which references a non-local URL allowed per the spec. Resource Locations seems to address this: https://w3c.github.io/epub-specs/epub33/core/#sec-resource-locations
Reading that seems to say no, this is not allowed, since the resource in question is not an audio resource, video resource, or font, nor is it being loaded by a script (though it may be loading scripts). The only argument I can see to allow it is to claim that an embedded video player is a video resource, since it plays a video. Our definition of video resource is sadly unspecific since we don't restrict codecs, but I believe the assumption is that a video resource should be some sort of direct media container and not a html document, script, or other non-video file.
There may be a desire to allow this, but that seems like a feature request out of scope for epub 3.3. I would propose closing this, although we may want to consider adding language either to the definition of video resource to clarify what we allow as one, or clarify the Resource Locations section to point out that iframe is not a loophole to allow loading of arbitrary external resources.
Just to be clear, in current distribution systems, large EPUBs are not allowed, and thus embedded video is not being done. Add to this that two codecs are embedded, because we do not require one video type, makes it worse.
Agree that it may be out of scope for 3.3, but we need to get it in the feature requests for the future. While we are at it, we need to make sure transcripts and the audio description track for videos that are described are supported.
Just to be clear, in current distribution systems, large EPUBs are not allowed, and thus embedded video is not being done. Add to this that two codecs are embedded, because we do not require one video type, makes it worse.
I agree that allowing large resources like audio and video to be external to the EPUB itself (that is, not part of the zip package) is a good idea, but that is allowed today. But the list of external resources is limited to audio, video, and fonts, plus some carve outs for scripting which is another topic. In the example provided, a video resource is not being referenced, an external web page is. There is no provision for that in the spec, as there really is no size argument to made for html content. Of course, you can always provide a link to external content like a video sharing website, but that will not be embedded in the content. It will likely open a new window, tab, or app depending on various device conditions.
Given that, what feature are you requesting? We could open all resource types to external content, though at that point I am not really sure why you wouldn't take the next logically step and make your book a website. Still that seems to be an entirely different question and should get a new feature request.
Just to clarify... I believe the original issue is really on youtube or vimeo (or similar) videos (or media) only, where the available URL-s are not referring to the media files themselves. I have just tried a simple HTML file with the URL cites by the original question (i.e., https://www.youtube.com/embed/qlMuzbjMASo
) and it indeed does not work. Put it another way, the original issue seems to be very specific to such media services, although the technical question, and the discussion so far, has looked at the question of iframe URL-s in a more general setting. I would propose to concentrate on the original question.
I agree with @toshiakikoike that including a reference, to be very specific, to a YouTube video (via iframe) may not be a good idea for an offline-able medium like an EPUB in the first place. However:
<video>
element? Because if the answer is latter, then we do not need iframes.If none of these examples really rely on iframes, and remembering @HadrienGardeur's reaction on the call whereby "as a RS developer, iframes in the content are your enemy", then I would agree to postpone this issue for now and not to extend version 3.3.
The examples shown in my https://github.com/w3c/epub-specs/issues/1061#issuecomment-743107469 have been placed in iframes but are NOT videos. I was showing some examples of interactive online content as this is a thread is about external content.
The first two examples can only be achieved when online (interacting with online 3D models and legally streaming online music). The third example (an interactive quiz) is extended by communication out from the EPUB to an online education service.
I can give other examples where iframes can be used to embed local but independent, already-existing HTML content into an EPUB page such as this https://www.youtube.com/watch?v=hPMxIj6-kyQ
To me, enhancing an ebook with curated content from a specific resource to the reader (students or otherwise) alongside regular content on the same page is very powerful and very different to suggesting they go away and open a link in a browser or that the publisher should attempt to 'make the whole book into a website’!
Reading systems might choose to disallow external content in iframes or even all iframe content, on security or complexity grounds, or they may wish to alert the reader to make that choice. Maybe we should insist on a placeholder or fallback be added to the EPUB for these cases?
I encourage you not to disallow either iframes or external content for current and future EPUBs and reading systems that do use and support it.
I'm not doubting the usefulness of being able to embed external content, but allowing it blurs the lines between reading a book and surfing the web. How does a user know which they are doing as they read?
More to the point, what safeguards are there for users who may not want their information sent off to a third party api, and may not realize that's what's happening when they submit a form or interact with a widget?
Does the author have to sanbox the iframe to prevent malicious code from interacting with the book, or are we expecting reading systems to add this?
I agree with Brady that if we're going to add this as a feature we at least need more time to work out the implications of it.
In my simple use case of a publisher wanting to use a video as a substitute for a still image, I do see where the publisher hosting the content on their servers where such assets are stored for EPUB (and HTML) usage is better than a YouTube example. I don’t think there is an iframe requirement, the publisher just wants to know the best practice technique to do this.
This is brought around by distribution limitations of size.
Looking into the issue a bit further, also in line of newer comments...
As @bduga said in https://github.com/w3c/epub-specs/issues/1061#issuecomment-939511581, the original request cannot be fulfilled per spec today because it says:
EPUB Creators MUST locate all Publication Resources in the EPUB Container, with the following exceptions:
- Audio resources
- Video resources
- Resources that scripts retrieve
- Font resources
However... the problem I see is that this is not a checkable requirement. The only way a tool like epubcheck could find out whether a URL points to one of the permitted resources is to make an HTTP request for the head and look at the media type. I do not think it is realistic to expect a tool to do that (e.g., it would preclude off-line usage of epubcheck). What this means for me is that, if we want a spec that reflects the current situation, the MUST above should actually be a SHOULD.
But then of course the situation becomes different. The current state is that iframes with external references already work for some RS-s as of today, as shows in the early tests of Dave or of Ken (the latter shows a book widget running in Thorium). And, with a SHOULD, there is no reason for an author not to do this. I.e., the current and, probably, purely aspirational restriction in the spec has already been bypassed in reality.
So maybe the right approach is to say:
I do not think it is realistic to expect a tool to do that
I'm not sure we want to use epubcheck as a design basis for the format. 😄
If we go that route, it calls into question most of the content documents restrictions. epubcheck doesn't load documents, either, so it really has no way of knowing what the dom actually consists of after all the scripts have run. That's always been a shortcoming you could use to work around this issue rather than simply lie about the media type in the package document (i.e., rewrite the src attribute of the iframe after the page loads).
Assuming we don't loosen the restriction, though, there probably are ways we could beef up validation. The simplest one might be to specify where remote resources are allowed, not just what types. So the wording, for example, could be "Audio resources when referenced from the audio
element" or "Video resources when referenced from the video
element."
That would allow epubcheck to more easily flag any remote resource referenced where it's not allowed, as it wouldn't have to know anything about its media type. It would also limit potential abuse, as you can't load a random resource into an audio
or video
element like you can with an iframe
. This might also help with our security review, as there's less damage a remote resource can do from audio/video elements and a css font declaration. (Not sure how much it does for scripts being able to read in remote resources, though.)
The issue was discussed in a meeting on 2021-10-14
List of resolutions:
<video>
I have created an enhanced epub with five videos embedded in the iframe, and the book works fine for a few readers. However, when I run epubcheck, it gives me an error as epub standards are set not to accept iframe. Many suggest using
<video></video>
However, since the Youtube video is not addressed as .MP4, the system inserts its controls, and the video does not display.
I have tried and added these lines to the content.opf for each video;
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml" properties="remote-resources"/> <item id="content_iframe" href="https://www.youtube.com/embed/xyz" media-type="text/html"/>
However, I still get the following error:
ERROR (RSC-006) at "ABC.epub/OEBPS/ABC.xhtml" (line 14, col 215):
Remote resource reference is not allowed; resources must be placed in the OCF.
By the way, I have checked all over this forum and many others to find a solution, to no avail. Is there a solution, or am I wasting my time?
Parvin.zip
From RickJ: