如何使用JavaScript从谷歌驱动器播放视频? [英] How to play video from google drive using javascript?
本文介绍了如何使用JavaScript从谷歌驱动器播放视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从使用JavaScript的谷歌驱动器播放视频?
它不起作用,我该怎么做?
http://fiddle.jshell.net/gt4otyfk/1/
< script type =text / javascript>
$(function(){
var video = $(#video)。get(0);
video.controls = true;
$(#play ).click(function(){
video.play();
});
});
< / script>
解决方案
Google提供了一些GET参数,如出口
和 id
与谷歌驱动器:
?export = download& id = YOUR_LONG_VIDEO_ID
让您能够插入已上传视频转换为HTML5视频标签。
这应该可以实现:
$(#play)。click(function(){$(#video)[0] .play();}); $ c $ < script src =https://ajax.googleapis.com/ajax
只需按下Run code snippet按钮即可运行此示例。希望这有助于。
How to play video from google drive using javascript?
It does not work, how can I do that?
http://fiddle.jshell.net/gt4otyfk/1/
<script type="text/javascript">
$(function(){
var video = $("#video").get(0);
video.controls = true;
$("#play").click(function() {
video.play();
});
});
</script>
解决方案
Google provides some GET-params like export
and id
with google-drive:
?export=download&id=YOUR_LONG_VIDEO_ID
to give you the ability to insert an uploaded video into a HTML5-video-tag.
This should work:
$("#play").click(function() {
$("#video")[0].play();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="play" style="margin-top: 300px;">Play</button>
<video id="video" width="320" height="240" controls>
<source src="https://drive.google.com/uc?export=download&id=0B8-qLYDzDfCyRF9vOE9sWmx5YjA" type='video/mp4'>
Your browser does not support the video tag.
</video>
Just press "Run code snippet"-button to run this example. Hope this helps.
这篇关于如何使用JavaScript从谷歌驱动器播放视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文