将视频插入HTML

时间:2012-11-06 16:11:21

标签: asp.net html html5

我尝试在HTML插入视频,因此我有视频网址,宽度和高度。是否足以构建正确的对象?我找到了如何为.SWF构建对象,但是如何构建任何其他格式?

P.S。我在服务器上没有视频文件,我使用外部视频网址作为源。

这是我的.SWF格式代码:

private string GetVideoType(string filename, out string formatHtml)
        {
            string videoType = formatHtml = "";

            if (filename.EndsWith(".swf"))
            {
                videoType = "swf";
                formatHtml = @"
                <object width='{0}' height='{1}' data='{2}' type='application/x-shockwave-flash'>
                    <param name='src' value='{2}'></param>
                    <param name='allowfullscreen' value='true'></param>
                    <param name='allowscriptaccess' value='always'></param>
                    <param name='allowScriptAccess' value='always'></param>
                    <param name='pluginspage' value='http://www.adobe.com/go/getflashplayer'></param>
                    <param name='wmode' value='window'></param>
                    <param name='flashvars' value='playerForm=LVPPlayer&mediaId=a46002fd61264c09a36a90ca66c994cb'></param>
                </object>";
            }
            else if (filename.EndsWith(".flv"))
            {
                videoType = "flv";
                formatHtml = "???"
            }
            else if (filename.EndsWith(".mp4"))
            {
                videoType = "mp4";
                formatHtml = "???"
            }
            else if (filename.EndsWith(".wmv"))
            {
                videoType = "wmv";
                formatHtml = "???"
            }

            return videoType;
        }

3 个答案:

答案 0 :(得分:0)

不确定您的要求,但如果您查看HTML5视频代码,则可能是值得的。以下是一些详细信息:http://www.w3schools.com/html/html5_video.asp

答案 1 :(得分:0)

也许应该看看HTML5标签。

代码在这里:

<video src="/video/example.ogg" width="320" height="240" controls>
<p>If you are reading this, it is because your browser does not support the HTML5 video element.</p>
</video>

答案 2 :(得分:0)

或者看看这个播放器:http://www.longtailvideo.com/players/jw-flv-player/

效果很好。

你可以使用mp4视频文件,它们在firefox中可见

html代码:

<div id="q1">Loading the player ...</div>

的javascript

<script type="text/javascript">
    jwplayer("q1").setup({
        flashplayer: "/public/javascript/jwp/player.swf",
        file: "/videos/q1.mp4",
        image: "/videos/q1.jpg",
        height: 349,
        width: 620
    });
</script>