当前位置: 首页 > 软件库 > Web应用开发 > >

jekyll-embed-video

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 姚信鸥
操作系统 未知
开源组织
适用人群 未知
 软件概览

jekyll-embed-video

Embed YouTube, Vimeo, Twitch, Facebook, Streamable, Google Drive videos/clips and more in Jekyll webpages without a plugin. If you are hosting your webpage using GitHub pages, you can't use third party plugins. Here is a method to use "includes" instead of plugins.

See the raw text in example.md for a complete example. Remember to add in video-embed.css for responsive videos that automatically resize with changing window dimensions.

Demo

http://www.nathan-lam.com/projects/jekyll-embed-video

Table of Contents

Embed YouTube

Create a file in your _includes folder called youtubePlayer.html with this code inside:

<div class="embed-container">
  <iframe
      src="https://www.youtube.com/embed/{{ include.id }}"
      width="700"
      height="480"
      frameborder="0"
      allowfullscreen="">
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include youtubePlayer.html id=page.youtubeId %}

On the top of your .md file, put the YouTube video ID. You could also put the ID of the video directly.

---
youtubeId: putYourIDHere
---

Embed Vimeo

Create a file in your _includes folder called vimeoPlayer.html with this code inside:

<div class="embed-container">
  <iframe
      src="https://player.vimeo.com/video/{{ include.id }}"
      width="500"
      height="281"
      frameborder="0"
      webkitallowfullscreen
      mozallowfullscreen
      allowfullscreen>
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include vimeoPlayer.html id=page.vimeoId %}

On the top of your .md file, put the Vimeo video ID. You could also put the ID of the video directly. Take a look at accessing and editing embed codes to find your video's embed code ID.

---
vimeoId: putYourIDHere
---

Embed Twitch

Embedding Twitch clips requires an additional "Domain" parameter. Create a file in your _includes folder called twitchPlayer.html with this code inside:

<div class="embed-container">
  <iframe
      src="https://clips.twitch.tv/embed?clip={{ include.id }}&parent={{ include.domain }}"
      height="360"
      width="640"
      frameborder="0"
      scrolling="no"
      allowfullscreen="true">
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include twitchPlayer.html id=page.twitchId domain=page.twitchDomain %}

On the top of your .md file, put the Twitch video ID and domain name. You could also put the ID of the video directly.

---
twitchId: putYourIDHere
twitchDomain: putYourDomainHere
---

See the embedding Twitch clips documentation for more details.

Embed Facebook

There are two types of Facebook videos/clips that you can embed: videos from the facebook feed using <iframe> or the newer Facebook Watch clips using the JavaScript SDK.

Standard Facebook feed videos

The raw <iframe> method works but is buggy since its non-standard and rips out the tracking they do. This method may be preferred if you absolutely don't want Facebook to have any tracking. The raw version works but it is very buggy. There's also no easy to way extract the video ID, it's very ugly.

Click the video until it's fullscreen which will give you the option to press the ... settings button. Next click on Embed. This will open up a dialog which will show you the <iframe> video code.

Note: If you don't fullscreen the video, it will not give you the Embed option.

Here's an example of what the non-standard <iframe> may look like:

<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Falmost.co%2Fvideos%2F986032852221964%2F&width=500&show_text=false&height=500&appId" width="500" height="500" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share" allowFullScreen="true"></iframe>

Instead of using a template, it may be better to manually insert the code. For this method, you would simply copy/paste that code similar to all the other _include files. Due to the difficulty, hassle, and weird embed behavior, there will no example of this method here. The recommendation is to use the newer Facebook Watch clips method.

Facebook Watch clips

Very Important: The newer Facebook Watch clips method requires you to import a JavaScript SDK script which very very likely does some tracking in the background but automatically handles video resizing and has smooth playback using their own CSS. If you are not okay with this then you would have to use the non-standard version.

Facebook pushed out their Watch feature on https://www.facebook.com/watch. This method can be used to embed any video from there. First choose a video you want to embed, then click on Share -> Embed -> Advanced Settings. This will open a new link. In the "Embedded Video Player Configurator", there will be a "URL of video" section which may look something like this:

https://www.facebook.com/pokergo/videos/1243061482783766/

If you already know the link of the specific video, the URL would look like this:

https://www.facebook.com/watch/?v=1243061482783766

In both of these cases, the video ID would be 1243061482783766.

Next create a file in your _includes folder called facebookPlayer.html with this code inside:

<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script async defer src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2"></script>

<!-- Your embedded video player code -->
<div 
    class="fb-video" 
    data-href="https://www.facebook.com/watch/?v={{ include.id }}"
    data-width="auto" 
    data-allowfullscreen="false">
</div>

Note: This is a ripped out version of the original JavaScript SDK code that Facebook provides which removes many unnecessary additions. If you want the original, click on Get Code on the advanced settings page.

Place this snippet inside your .md file where you want to embed your video:

{% include facebookPlayer.html id=page.facebookId %}

On the top of your .md file, put the Facebook video ID. You could also put the ID of the video directly.

---
facebookId: 1243061482783766 
---

Facebook uses their own video parameters, for more information take a look at the Embedded Video & Live Video Player documentation.

Embed Streamable

Create a file in your _includes folder called streamablePlayer.html with this code inside:

<div class="embed-container">
  <iframe
      src="https://streamable.com/s/{{ include.id }}"
      height="360"
      width="640"
      frameborder="0"
      scrolling="no"
      allowfullscreen="true">
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include streamablePlayer.html id=page.streamableId %}

On the top of your .md file, put the Streamable video ID. You could also put the ID of the video directly.

---
streamableId: putYourIDHere
---

To find your embed video ID use Streamable's free online tool

Embed Google Drive

Recommendation: Upload your video to YouTube instead since it has better built in video player functionality.

Embedding Google Drive videos have additional steps.

  1. For the desired video, change the link sharing setting to On - Anyone with the link. This will make the video accessible to anyone who has the link as no sign-in is required.

    Important: If you do not change the video setting to this option, your video will not show.

  2. Double click the video to show the preview. Click the setting options and select "Open in new window". Now click on the setting option again and select "Embed item". The iframe code should appear. For example:

<iframe src="https://drive.google.com/file/d/1EC8BnjJMon-vqy-UhLKk9sf_oukZzEbP/preview"></iframe>

1EC8BnjJMon-vqy-UhLKk9sf_oukZzEbP/preview would be your video ID.

Note: Right clicking the video will not bring up the embed option. You must open the video in a new window.

Create a file in your _includes folder called googleDrivePlayer.html with this code inside:

<div class="embed-container">
  <iframe
      width="640"
      height="480"
      src="https://drive.google.com/file/d/{{ include.id }}"
      frameborder="0"
      allowfullscreen="">
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include googleDrivePlayer.html id=page.driveId %}

On the top of your .md file, put the Google Drive video ID. You could also put the ID of the video directly.

---
driveId: putYourIDHere
---

Additional support

Embed 20Detik

Create a file in your _includes folder called 20detikPlayer.html with this code inside:

<div class="embed-container">
  <iframe
      src="https://20.detik.com/embed/{{ include.id }}"
      width="700"
      height="480"
      frameborder="0"
      scrolling="no"
      allowfullscreen="true">
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include 20detikPlayer.html id=page.detikId %}

On the top of your .md file, put the Detik video ID. You could also put the ID of the video directly.

---
detikId: 190130051
---

Embed Dailymotion

Create a file in your _includes folder called dailymotionPlayer.html with this code inside:

<div class="embed-container">
  <iframe
      src="https://www.dailymotion.com/embed/video/{{ include.id }}"
      width="700"
      height="480"
      frameborder="0"
      allowfullscreen=""
      allow="autoplay">
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include dailymotionPlayer.html id=page.dailymotionId %}

On the top of your .md file, put the Dailymotion video ID. You could also put the ID of the video directly.

---
dailymotionId: x2btuie
---

Embed Vidio

Create a file in your _includes folder called vidioPlayer.html with this code inside:

<div class="embed-container">
  <iframe
      src="https://www.vidio.com/embed/{{ include.id }}"
      width="700"
      height="480"
      scrolling="no"
      frameborder="0"
      allowfullscreen="">
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include vidioPlayer.html id=page.vidioId %}

On the top of your .md file, put the Vidio video ID. You could also put the ID of the video directly.

---
vidioId: 1671743
---

Embed LINE Today

LINE Today contents are served in different countries so another country parameter (to be filled with a 2-letter country code) is needed. Here's all the supported country codes (case-insensitive)

  • hk - Hong Kong
  • id - Indonesia
  • th - Thailand
  • tw - Taiwan

Create a file in your _includes folder called linetodayPlayer.html with this code inside:

<div class="embed-container">
  <iframe
      src="https://today.line.me/{{ include.country }}/embed/{{ include.id }}"
      width="700"
      height="480"
      frameborder="0"
      allowfullscreen=""
      allow="autoplay; encrypted-media">
  </iframe>
</div>

Place this snippet inside your .md file where you want to embed your video:

{% include linetodayPlayer.html id=page.linetodayId country=page.countryId %}

On the top of your .md file, put the LINE Today video and country ID. You could also put the IDs directly.

---
linetodayId: abcdefg 
countryId: hk
---

Responsive Videos

For responsive videos that automatically resize with changing window sizes, add in video-embed.css.

.embed-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.embed-container iframe, .embed-container object, .embed-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

Iframe Attributes

These attributes are defined in the MDN web docs. You can set various additional attributes no matter what provider you use.

Name Type Description
allowfullscreen boolean If true, the player can go full screen.
height integer Height of the embedded window, in pixels.
width integer Width of the embedded window, in pixels.
scrolling boolean Indicates when the browser should provide a scroll bar (or other scrolling device) for the frame. Recommended: no.
src string The video/clip source URL link.
autoplay boolean If true, the video starts playing automatically, without the user clicking play. The exception is mobile devices, on which video cannot be played without user interaction. Default: true.
muted boolean Specifies whether the initial state of the video is muted. Default: false.
time 1h2m3s Time in the video where playback starts. Specifies hours, minutes, and seconds. Default: 0h0m0s (the start of the video).

Full example

---
youtubeId: putYourIDHere
vimeoId: putYourIDHere
twitchId: putYourIDHere
twitchDomain: putYourDomainHere
facebookId: putYourIDHere
streamableId: putYourIDHere
driveId: putYourIDHere
detikId: putYourIDHere
dailymotionId: putYourIDHere
vidioId: putYourIDHere
linetodayId: putYourIDHere
countryId: putYourIDHere
---

## Embed Youtube

<!---
Include this next line in your .md for Youtube videos, make sure to put your video ID up there!

Example:     youtubeId: lDi9uFcD7XI
-->

{% include youtubePlayer.html id=page.youtubeId %}

## Embed Vimeo

<!---
Include this next line in your .md file for Vimeo videos, make sure to put your video ID up there!

Example:     vimeoID: 22439234
-->

{% include vimeoPlayer.html id=page.vimeoId %}

## Embed Twitch

<!---
Include this next line in your .md file for Twitch videos, make sure to put your video ID and domain up there!

Example:     twitchId: GrotesqueArbitraryGullPupper
             twitchDomain: www.nathan-lam.com
-->

{% include twitchPlayer.html id=page.twitchId domain=page.twitchDomain %}

## Embed Facebook

<!---
Include this next line in your .md file for Facebook videos, make sure to put your video ID up there!

Example:     facebookId: 1243061482783766 
-->

{% include facebookPlayer.html id=page.facebookId %}

## Embed Streamable

<!---
Include this next line in your .md file for Streamable videos, make sure to put your video ID up there!

Example:     streamableId: s9ijg 
-->

{% include streamablePlayer.html id=page.streamableId %}

## Embed Google Drive

<!---
Include this next line in your .md file for Google Drive videos, make sure to put your video ID up there!

Example:     driveId: 0B7L_dMcaZknxVTRndmdSQ0F5OFE/preview
-->

{% include googleDrivePlayer.html id=page.driveId %}

## Embed 20Detik

<!---
Include this next line in your .md file for 20Detik videos, make sure to put your video ID up there!

Example:     detikId: 190130051
-->

{% include 20detikPlayer.html id=page.detikId %}

## Embed Dailymotion

<!---
Include this next line in your .md file for Dailymotion videos, make sure to put your video ID up there!

Example:     dailymotionId: x2btuie
-->

{% include dailymotionPlayer.html id=page.dailymotionId %}

## Embed Vidio

<!---
Include this next line in your .md file for Vidio videos, make sure to put your video ID up there!

Example:     vidioId: 1671743
-->

{% include vidioPlayer.html id=page.vidioId %}

## Embed LINE Today

<!---
Include these next lines in your .md file for LINE Today videos, make sure to put your video and country ID up there!

Example:     linetodayId: abcdefg 
             countryId: hk
-->

{% include linetodayPlayer.html id=page.linetodayId country=page.countryId %}
  • I am trying to display a video file inside a PySide2 app I'm writing. That app uses a QWebEngineView and loads a local html file that contains a tag, pointing to a local mov or mp4 file. Somehow I can

  • 1、在kindeditor.js源码中找到k.options = [embed:''],在embed后面插入如下代码: video: ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autoplay', 'quality', '.width', '.height', 'align', 'controls', 'muted','

  • package com.dou361.ijkplayer.widget; import android.annotation.TargetApi; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.conten

  • https://stackoverflow.com/questions/1000851/embed-mp4-in-html-using-flash-player *************************************************************** Yes you can. Flash 9.0.115 is required. Flowplayer is m

  • Jekyll 搭建过程 关于Jekyll Jekyll本身是基于Ruby,它实际上也可以看成是一种模板引擎liquid的扩展。jekyll对liquid的主要扩展在于两点: 内建专用于博客网站的对象,可以在模板中引用这些对象:page、site等 对liquid进行了扩展,方便构建博客网站 类似其他的模板引擎一样,标记是模板引擎解析的关键,liquid设计了如下两种标记: {{ }}:此标记表征的

  • embed object以及video标签的区别以及使用? 转载于:https://www.cnblogs.com/annie211/p/5933541.html

  • html5里的一些新的标签,看到里面object、embed、video、audio都可以添加视频或音频文件 embed是针对非IE的浏览器的媒体播放器 video是html5出的一种新标准,但并不是所有的浏览器都支持。video虽然号称可以支持三种媒体类型,但常用的只有mp4。 像object,和embed是都可以用来播放视频和音频,而且他们展示效果基本上一样的,   1、 video、audi

  • 发现一个很帅的popup video effect。 是 http://www.siggraph.org/publications/video-review/SVR.html 上看到的。 Video LightBox 官网:http://videolightbox.com/

  • 当我们将视频上传并保存到tomcat等服务器文件夹时, 我们可能保存的路径可能是这样的:E:\apache-tomcat-7.0.56\webapps\ExcellentCourse\uploadFiles\2015-03-19\20150319211935_495.mp4 当我们利用video、object、embed等多媒体元素播放时,可能需要将该路径放到src中,但是这样的路径是属于本地资源

  • (一)、基本语法:          pluginspage=http://www.microsoft.com/windows/mediaplayer/download/default.asp   embed src=url   说明:embed可以用来插入各种多媒体,格式可以是 Midi、Wav、AIFF、AU、MP3等等,       Netscape及新版的IE 都支持。url为音频或视频文

  •  <embed width="300" height="300" type="application/x-silverlight" source="test.xaml">   <object width="300" height="300" data="data:application/x-silverlight," type="application/x-silverlight">       

 相关资料
  • 描述 内嵌内容容器,在 Weex 容器中通过 <web> 实现,在 Web 容器中通过 <iframe> <embed> 实现。 安装 $ npm install rax-embed --save 属性 属性 类型 默认值 必填 描述 支持 src String - ✘ 嵌入的页面地址   urlParam String | Object - ✘ 传递给子页面的参数   page_inside_e

  • 在C++程序中可以内嵌一个ZendVM,实现与PHP程序的交互。需要依赖PHP官方的embed模块。编译PHP时需要增加--enable-embed参数。 编写程序 #include "phpx_embed.h" #include <iostream> using namespace php; using namespace std; int main(int argc, char * arg

  • A lightweight JavaScript plugin to embed emojis, media, maps, tweets, code and services. This is the documentation for v5. If you are looking for docs of v4 you can get them here. Features Supported:

  • The Page Embed plugin embeds a page in the content using an iframe (Inline frames). The size of these iframes can be configured to be responsive or another user-defined dimension. The ability to use i

  • The Page Embed plugin is a premium plugin from Tiny that embeds a page in the content using an iframe (Inline frames). The Page Embed plugin allows an external webpage to be embedded in an HTML docume

  • Live example This example shows how to use the Page Embed plugin to embed a page in the content in a responsive or exactly sized iframe.For more information on the Page Embed plugin, see the docs. Tin