如何使用javascript嵌入dropbox中的视频?

如何使用javascript嵌入dropbox中的视频?,javascript,jquery,youtube-api,dropbox,dropbox-api,Javascript,Jquery,Youtube Api,Dropbox,Dropbox Api,我试图嵌入来自youtube的视频,但因为youtube的品牌。即使在添加了require参数之后,youtube品牌也没有完全隐藏。所以我想换个角度 我想从dropbox现在嵌入mp4视频。我该怎么做呢 以下是我在youtube上使用的参考代码 youtubeLoadVideos : function () { var videos = document.getElementsByClassName("youtube"); for (var i=0; i<vide

我试图嵌入来自youtube的视频,但因为youtube的品牌。即使在添加了require参数之后,youtube品牌也没有完全隐藏。所以我想换个角度

我想从dropbox现在嵌入mp4视频。我该怎么做呢

以下是我在youtube上使用的参考代码

youtubeLoadVideos : function () {
    var videos = document.getElementsByClassName("youtube");
        for (var i=0; i<videos.length; i++) {
            var youtube = videos[i];
            var iframe = document.createElement("iframe");              
            iframe.setAttribute("src", "http://www.youtube.com/embed/" + youtube.id + "?modestbranding=1&;showinfo=0&;autohide=1&;enablejsapi=1&;origin=http://www.youtube.com&;rel=0;");

            iframe.style.width = youtube.style.width;
            iframe.style.height = youtube.style.height;
            iframe.style.clear = 'both';
            youtube.parentNode.appendChild(iframe, youtube);
                        }
    }
此视频正在加载和播放,但没有播放按钮和音量按钮。简而言之,没有控制栏。 我们能为此做些什么

最新更新2:

new_video = document.createElement('video');
video = document.getElementById('RIZfC358yRk').appendChild(new_video);
source = document.createElement('source');  
source.setAttribute('src','https://dl.dropboxusercontent.com/u/87532981/Ella%20May%20and%20the%20Wishing%20Stone%20By%20Cary%20Fagan.mp4');
video.appendChild(source);
video.play();
有了这个,我可以添加视频,但在这个控制栏也丢失了。 播放按钮不存在,进度条不存在,暂停按钮也不存在。 我如何添加这些?
请帮我找出这个问题

这就是你想要实现的目标吗

例如:

<video controls="controls" height="480" width="640">
<source src="https://dl.dropboxusercontent.com/u/87532981/Ella%20May%20and%20the%20Wishing%20Stone%20By%20Cary%20Fagan.mp4" type="video/mp4"></source>
</video>

您可以随时动态更改视频文件url,具体取决于您希望如何更改。

这就是您想要实现的目标吗

new_video = document.createElement('video');
new_video.setAttribute('controls','true');
new_video.setAttribute('autoBuffering','true');

video = document.getElementById('RIZfC358yRk').appendChild(new_video);

source = document.createElement('source');  
source.setAttribute('src','https://dl.dropboxusercontent.com/u/87532981/Ella%20May%20and%20the%20Wishing%20Stone%20By%20Cary%20Fagan.mp4');

video.appendChild(source);

video.load();
video.play();

例如:

<video controls="controls" height="480" width="640">
<source src="https://dl.dropboxusercontent.com/u/87532981/Ella%20May%20and%20the%20Wishing%20Stone%20By%20Cary%20Fagan.mp4" type="video/mp4"></source>
</video>

您可以随时动态更改视频文件url,具体取决于您希望如何更改视频文件url。

有一些报告称,这在Dropbox()上不再有效。但是,此URL上的解决方案似乎有效:

new_video = document.createElement('video');
new_video.setAttribute('controls','true');
new_video.setAttribute('autoBuffering','true');

video = document.getElementById('RIZfC358yRk').appendChild(new_video);

source = document.createElement('source');  
source.setAttribute('src','https://dl.dropboxusercontent.com/u/87532981/Ella%20May%20and%20the%20Wishing%20Stone%20By%20Cary%20Fagan.mp4');

video.appendChild(source);

video.load();
video.play();
在第二个链接中提倡的解决方案是使用“?raw=1”后缀

这似乎是Dropbox在其网站上推广的合法功能:这里也是


(自从发布这篇文章以来,我已经转而使用AWS S3 bucket。以我的使用水平来看,它非常简单,也非常便宜。)

有一些报告称,这在Dropbox()上不再有效。但是,此URL上的解决方案似乎有效:

在第二个链接中提倡的解决方案是使用“?raw=1”后缀

这似乎是Dropbox在其网站上推广的合法功能:这里也是


(自从发布这篇文章后,我已经改用AWS S3存储桶。以我的使用水平来看,它非常简单,也非常便宜。)

在DropBox上上传视频>获取公共链接>在链接中只需替换后缀“?dl=0”到“?raw=1”

在DropBox上上传视频>在链接中获取公共链接>只需替换后缀”?dl=0“到”?raw=1”

是的。但这是我们可以用javascript格式为多个视频做的吗?我正在尝试使用以下代码,“new#video=document.createElement('video');new#source=document.createElement('source');var videoFile=”;$('container new#video new#source')。attr('src',videoFile);$(“#container new video#video”)[0]。play()”。但它在控制台中给了我一个错误“UncaughtTypeError:无法调用undefined”的方法“play”,如果我这样做:“new_video=document.createElement('video');new_source=document.createElement('source');final\u video=document.getElementById('RIZfC358yRk').appendChild(新视频)。appendChild(新视频源);final_video.setAttribute('src',');“然后只有黑屏出现……无法播放。怎么办?新建视频=文档。createElement('video');新建源=文档。新建元素('source');最终视频1=文档。getElementById('RIZfC358yRk')。appendChild(新建视频)最终视频=文档。getElementById('RIZfC358yRk')。appendChild(新建视频)。appendChild(新建源);final_video.setAttribute('src',');final_video1[0].play();也尝试了此操作,但“未捕获类型错误:无法调用未定义的方法”play“我用尝试过的可能性编辑了我的问题。请看一看。是的。但这是否可以用javascript格式处理多个视频?我正在使用以下代码进行尝试,”new_video=document.createElement('video');new_source=document.createElement('source');var videoFile=''$(“#container new_video new_source”).attr('src',videoFile)$(“#容器新#视频”)[0]。播放();“。但它在控制台“uncaughttypeerror:无法调用未定义的方法‘play’”中给了我错误,如果我这样做的话:“new_video=document.createElement(‘video’);new_source=document.createElement('source');final\u video=document.getElementById('RIZfC358yRk').appendChild(新视频)。appendChild(新视频源);final_video.setAttribute('src',');“然后只有黑屏出现……无法播放。怎么办?新建视频=文档。createElement('video');新建源=文档。新建元素('source');最终视频1=文档。getElementById('RIZfC358yRk')。appendChild(新建视频)最终视频=文档。getElementById('RIZfC358yRk')。appendChild(新建视频)。appendChild(新建源);final_video.setAttribute('src',');final_video1[0].play();也尝试了此操作,但“未捕获类型错误:无法调用未定义的方法'play'“我用尝试过的可能性编辑了我的问题。请看一看。应更新已接受的答案以包含此重要信息。应更新已接受的答案以包含此重要信息。
new_video = document.createElement('video');
new_video.setAttribute('controls','true');
new_video.setAttribute('autoBuffering','true');

video = document.getElementById('RIZfC358yRk').appendChild(new_video);

source = document.createElement('source');  
source.setAttribute('src','https://dl.dropboxusercontent.com/u/87532981/Ella%20May%20and%20the%20Wishing%20Stone%20By%20Cary%20Fagan.mp4');

video.appendChild(source);

video.load();
video.play();