Video not working when page is exported as HTML #714

Closed
opened 2026-02-04 21:59:06 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @durgasravani23 on GitHub (Jun 10, 2018).

For Bug Reports

  • BookStack Version: v0.22.0
  • PHP Version: 7.x
  • Maria DB Version: 10.x
Expected Behavior

Should be able to view the video in the page, after exporting it as html file.

Current Behavior

File not found is displayed in the iframe where is video is supposed to be displayed.

In FireFox:

html-with-video-FF

In Chromium:

html-with-video-chromium

Steps to Reproduce
  1. Add a video to a page and save it. (I added - //www.youtube.com/embed/naW9U8MiUY0)
  2. Click on Export
  3. Select Contained Web File (.html)
  4. Open the html file in the browser ( I tested it in Firefox 57.0.3 and Chromium 63.0.3239.108)
Originally created by @durgasravani23 on GitHub (Jun 10, 2018). ### For Bug Reports * BookStack Version: v0.22.0 * PHP Version: 7.x * Maria DB Version: 10.x ##### Expected Behavior Should be able to view the video in the page, after exporting it as html file. ##### Current Behavior File not found is displayed in the iframe where is video is supposed to be displayed. ###### In FireFox: ![html-with-video-FF](https://user-images.githubusercontent.com/36889176/41201569-1aad176a-6cd8-11e8-881b-06acc14db6ff.png) ###### In Chromium: ![html-with-video-chromium](https://user-images.githubusercontent.com/36889176/41201589-4ad063de-6cd8-11e8-8af6-343763c4c5ca.png) ##### Steps to Reproduce 1. Add a video to a page and save it. (I added - //www.youtube.com/embed/naW9U8MiUY0) 2. Click on Export 3. Select Contained Web File (.html) 4. Open the html file in the browser ( I tested it in Firefox 57.0.3 and Chromium 63.0.3239.108)
OVERLORD added the 🐛 Bug🚚 Export System labels 2026-02-04 21:59:06 +03:00
Author
Owner

@TBK commented on GitHub (Jun 10, 2018):

I can confirm this.

The issue is caused by the link src url beind invalid:
<iframe allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/naW9U8MiUY0" width="560" height="314">

Since HTML does not include the js magic the src url sould be:
<iframe allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/naW9U8MiUY0" width="560" height="314">

@TBK commented on GitHub (Jun 10, 2018): I can confirm this. The issue is caused by the link src url beind invalid: `<iframe allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/naW9U8MiUY0" width="560" height="314">` Since HTML does not include the js magic the src url sould be: `<iframe allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/naW9U8MiUY0" width="560" height="314">`
Author
Owner

@Abijeet commented on GitHub (Jun 17, 2018):

Currently we do not handle video in the HTML export and I think this will be a problem with the PDF export as well.

My vote would be to just replace the video tag with the source. Something like this,

Video : https://www.youtube.com/watch?v=C0DPdy98e4c

This could be implemented across Text, HTML and PDF export.

@Abijeet commented on GitHub (Jun 17, 2018): Currently we do not handle video in the HTML export and I think this will be a problem with the PDF export as well. My vote would be to just replace the video tag with the source. Something like this, Video : https://www.youtube.com/watch?v=C0DPdy98e4c This could be implemented across Text, HTML and PDF export.
Author
Owner

@ssddanbrown commented on GitHub (Jun 18, 2018):

Yeah, I agree @TBK, The URL is causing this. The url used is protocol relative (//) so when you open the HTML file locally (Not via a HTTP server) it tries to access the video via file://www.youtube.com/embed/naW9U8MiUY0 which is obviously not what you want.

Annoying it looks like the TinyMCE media plugin is setting this URL to be like this. Youtube provides direct https links which would be fine. For a temporary fix you can edit the page HTML directly and change it to https. Ideally we'd find a way to prevent TinyMCE reformatting the link.

@Abijeet I think embedded iframe videos works quite well still for HTML exports. Your suggestion is a good idea for the other export options though.

@ssddanbrown commented on GitHub (Jun 18, 2018): Yeah, I agree @TBK, The URL is causing this. The url used is protocol relative (`//`) so when you open the HTML file locally (Not via a HTTP server) it tries to access the video via `file://www.youtube.com/embed/naW9U8MiUY0` which is obviously not what you want. Annoying it looks like the TinyMCE media plugin is setting this URL to be like this. Youtube provides direct https links which would be fine. For a temporary fix you can edit the page HTML directly and change it to `https`. Ideally we'd find a way to prevent TinyMCE reformatting the link. @Abijeet I think embedded iframe videos works quite well still for HTML exports. Your suggestion is a good idea for the other export options though.
Author
Owner

@Abijeet commented on GitHub (Jul 1, 2018):

Yea, TinyMCE seems to be doing this for certain URLs, corresponding code here - https://github.com/tinymce/tinymce/blob/master/src/plugins/media/main/ts/core/UrlPatterns.ts#L30

@Abijeet commented on GitHub (Jul 1, 2018): Yea, TinyMCE seems to be doing this for certain URLs, corresponding code here - https://github.com/tinymce/tinymce/blob/master/src/plugins/media/main/ts/core/UrlPatterns.ts#L30
Author
Owner

@ssddanbrown commented on GitHub (Jul 1, 2018):

@Abijeet Good find, I have just opened tinymce/tinymce#4479 as a chance to fix this. Would prefer to fix it upstream rather than maintain a copy of the plugin.

@ssddanbrown commented on GitHub (Jul 1, 2018): @Abijeet Good find, I have just opened tinymce/tinymce#4479 as a chance to fix this. Would prefer to fix it upstream rather than maintain a copy of the plugin.
Author
Owner

@Abijeet commented on GitHub (Jul 2, 2018):

@ssddanbrown - I've fixed this in the ExportService in this PR here - https://github.com/BookStackApp/BookStack/pull/908/files

Even if TinyMCE fixes it in upstream, we will have to fix it for the video tag in PDF and Text. I guess we can wait for a few days and decide what to do on that.

@Abijeet commented on GitHub (Jul 2, 2018): @ssddanbrown - I've fixed this in the ExportService in this PR here - https://github.com/BookStackApp/BookStack/pull/908/files Even if TinyMCE fixes it in upstream, we will have to fix it for the video tag in PDF and Text. I guess we can wait for a few days and decide what to do on that.
Author
Owner

@ssddanbrown commented on GitHub (May 30, 2022):

Just coming back to this, TinyMCE changes have now been made and it seems much better at adjusting protocol relative URLs in a range of scenarios I tested with YouTube embed methods.

Since this original issue is much less likely to occur, unless specifically going to effort to force protocol relative URLs, I'll close this off.

@ssddanbrown commented on GitHub (May 30, 2022): Just coming back to this, TinyMCE changes have now been made and it seems much better at adjusting protocol relative URLs in a range of scenarios I tested with YouTube embed methods. Since this original issue is much less likely to occur, unless specifically going to effort to force protocol relative URLs, I'll close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#714