【问题标题】:Play video in jquery popup from file system?在文件系统的 jquery 弹出窗口中播放视频?
【发布时间】:2013-09-17 14:49:34
【问题描述】:

我想在我的 ASP.NET 应用程序的 jquery 弹出窗口中从文件系统而不是从网站链接(即 youtube 或 vimeo)播放视频。我在互联网上搜索过,但似乎都是为 youtube 等开发的。请帮助我集成一个简单的 jquery 弹出窗口,它很容易与 ASP.NET 兼容,并且可以播放特定类型扩展的视频。提前致谢。

【问题讨论】:

  • 出于安全原因,我认为不允许脚本访问用户的文件系统。
  • @JoachimVR 我不这么认为,因为有很多脚本可以显示来自文件系统的图像,并且我已经在我的应用程序中使用它,如果存在安全问题,那么它也应该存在于其他情况

标签: jquery asp.net video popup


【解决方案1】:

我的 jsfiddle 演示 - https://jsfiddle.net/akshayshringi/e7tqycdj/

<div class="container">
<h2>Modal Example</h2>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" id="showvideo">Open Modal</button>
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<video width="400" controls>
<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>


$('#showvideo').click(function(){
$("video").html('<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4" type="video/mp4">');
$("video")[0].load();
$('#myModal').modal('show');
$('video')[0].play();
});
$('#myModal').on('hidden.bs.modal', function () {
$("video").html('');
$("video")[0].load();
})

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-02
    • 1970-01-01
    • 2014-09-30
    • 2011-02-19
    • 1970-01-01
    • 1970-01-01
    • 2016-05-08
    相关资源
    最近更新 更多