GitHub pages generator removing <video> tag

百般思念 提交于 2020-12-26 07:55:24

问题


Context

I usually set up quick GitHub pages to document a few developments I do. They are usually very simple pages, which I generate from the repo settings using the Page Generator. I want to continue using this method, as moving to proper gh-pages with jekyll is too much of an overhead for something so simple.

Recently I came across a use case, where adding a simple 2 min video to the first section made a lot of sense. Not knowing any native markdown for HTML video I've decided to add the HTML code directly as I do in a lot of other situations:

<video width="640" height="400" controls preload> 
    <source src="https://github.my.company.com/Org/sample/blob/master/intro.mp4?raw=true"></source> 
</video>

Problem

When I generate the page the tag is not there, which normally happens when the video tag is not supported. If I open the chrome console and edit the HTML directly, as expected, the video shows fine and I can play it, etc.

I can only assume that GitHub markdown engine, is removing the video tag because the context in which is running does not support video (headless, non-compatible agent, whatnot).

Since GitHub says it supports native HTML into page rendering, there's no specific markdown to say "DO NOT PARSE THIS AT ALL COSTS", leaving me without many options left.

Question

Has anyone come across this issue, and do you know if it's possible to have a video tag in a generated page without moving on to Jekyll?


回答1:


You can delegate all the heavy job to a video hosting service.

Advantages are :

  • they do all the html video / flash fallback for you
  • they can serve proper encoding / bandwith depending on device / network
  • they have specialized CDN that ensure good delivery (? depends on carrier but you cannot know)

Everybody in the industry delegates the pain of video management.

And the only code you have to add is something like this :

<iframe width="420" height="315" src="//www.youtube.com/embed/KgLfpnPdqZw" frameborder="0" allowfullscreen></iframe>


来源:https://stackoverflow.com/questions/25000075/github-pages-generator-removing-video-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!