如何从数据库动态更改视频src属性 [英] How to change video src attribute dynamically from database
本文介绍了如何从数据库动态更改视频src属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有带有视频src路径的SQL数据库,我必须在24小时后动态播放HTML5视频播放器中的视频
。我可以实现这一点..请帮助这是紧急的。
前端
I have SQL database with video src path, I have to play videos in HTML5 video player
dynamically after evry 24 hours . I could i Achieve this .. Please help this is urgent.
Front End
<video id="homevideo" width="100%" controls onended="run()" runat="server">
<source type='video/mp4'/></video>
CodeBehind:
CodeBehind:
protected void Page_Load(object sender, EventArgs e)
{
String dir = "video/1.mp4";
homevideo.Attributes.Add("src", dir);
}
推荐答案
如果你有框架4.5,那么< video>当您使用runat =server时,标记映射到HtmlVideo类...您可以使用它来处理源 - http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlvideo(v = vs.110)。 aspx [ ^ ]
在以前的框架版本中,此类标记映射到通用html控件,这只是阻止您在其上设置任何有意义的属性。因此,如果您在基于Web表单的应用程序中使用HTML5视频 - 抓住.NET 4.5 ......
If you have framework 4.5, the <video> tag maps to the HtmlVideo class when you use runat="server"... You can use it to handle the source - http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlvideo(v=vs.110).aspx[^]
In previous framework versions such tag maps to a generic html control, that just prevent from you to set anything meaningful attribute on it. So if you are working with HTML5 video in web forms based application - grab .NET 4.5...
这篇关于如何从数据库动态更改视频src属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文