如何在asp.net网站上播放flv视频文件? [英] How to play flv video file on asp.net website?
本文介绍了如何在asp.net网站上播放flv视频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在播放我网站上的flv文件时遇到问题.我想在单击此图像时像youtube概念一样播放我的视频,以显示该视频的静止图像.
Hi,
I am facing problem on playing flv files on my website. i want to show still image for this video when click this image play my video just like youtube concept.
推荐答案
转到此处以了解如何在ASP中显示视频.净额:
ASP.NET嵌入式视频播放器(YouTube™API,C#)
使用ASP.NET 2.0,IIS和HTTP处理程序的视频流
在.net中显示视频(带有Asp.net的C#)
在ASP.NET 2.0中显示视频
Go here for learning on how to display videos in ASP.NET:
ASP.NET Embedded Video Player (YouTube™ API, C#)
video streaming with ASP.NET 2.0, IIS and HTTP handler
display video in .net ( C# with Asp.net )
Display videos in ASP.NET 2.0
只需更改scr中的URL var值即可........
Just Change the URL var value in scr..........
<script language="javascript" type="text/javascript">
function openYouTube() {
var id = document.getElementById("YouTubeLink").value;
if (id != "") {
//YouTube Player Parameters
var width = 550;
var height = 350;
var FullScreen = "yes";
var AutoPlay = "yes";
var HighDef = "yes";
//Calculate Page width and height
var pageWidth = window.innerWidth;
var pageHeight = window.innerHeight;
if (typeof pageWidth != "number") {
if (document.compatMode == "CSS1Compat") {
pageWidth = document.documentElement.clientWidth;
pageHeight = document.documentElement.clientHeight;
} else {
pageWidth = document.body.clientWidth;
pageHeight = document.body.clientHeight;
}
}
// Make Background visible...
var divbg = document.getElementById('bg');
divbg.style.visibility = "visible";
//Create dynamic Div container for YouTube Popup Div
var divobj = document.createElement('div');
divobj.setAttribute('id', id); // Set id to YouTube id
divobj.className = "popup";
divobj.style.visibility = "visible";
var divWidth = width + 4;
var divHeight = height + 20;
divobj.style.width = divWidth + "px";
divobj.style.height = divHeight + "px";
var divLeft = (pageWidth - divWidth) / 2;
var divTop = (pageHeight - divHeight) / 2 - 10;
//Set Left and top coordinates for the div tag
divobj.style.left = divLeft + "px";
divobj.style.top = divTop + "px";
//Create dynamic Close Button Div
var closebutton = document.createElement('div');
closebutton.style.visibility = "visible";
closebutton.innerHTML = "<span onclick=\"closeYouTube('" + id + "')\" class=\"close_button\">X</span>";
//Add Close Button Div to YouTube Popup Div container
divobj.appendChild(closebutton);
//Create dynamic YouTube Div
var ytobj = document.createElement('div');
ytobj.setAttribute('id', "yt" + id);
ytobj.className = "ytcontainer";
ytobj.style.width = width + "px";
ytobj.style.height = height + "px";
if (FullScreen == "yes") FullScreen = "&fs=1"; else FullScreen = "&fs=0";
if (AutoPlay == "yes") AutoPlay = "&autoplay=1"; else AutoPlay = "&autoplay=0";
if (HighDef == "yes") HighDef = "&hd=1"; else HighDef = "&hd=0";
var URL = "http://www.youtube.com/v/" + id + "&hl=en&rel=0&showsearch=0" + FullScreen + AutoPlay + HighDef;
var YouTube = "<object width=\"" + width + "\" height=\"" + height + "\">";
YouTube += "<param name=\"movie\" value=\"" + URL + "\"></param>";
YouTube += "<param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param>";
YouTube += "<embed src=\"" + URL + "\" type=\"application/x-shockwave-flash\" ";
YouTube += "allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"" + width + "\" height=\"" + height + "\"></embed></object>";
ytobj.innerHTML = YouTube;
//Add YouTube Div to YouTube Popup Div container
divobj.appendChild(ytobj);
//Add YouTube Popup Div container to HTML BODY
document.body.appendChild(divobj);
}
else {
var divbg = document.getElementById('text');
divbg.style.visibility = "visible";
divbg.innerHTML = "No Video Uploaded for this Product!";
}
}
function closeYouTube(id) {
var divbg = document.getElementById('bg');
divbg.style.visibility = "hidden";
var divobj = document.getElementById(id);
var ytobj = document.getElementById("yt" + id);
divobj.removeChild(ytobj); //remove YouTube Div
document.body.removeChild(divobj); // remove Popup Div
}
</script>
这篇关于如何在asp.net网站上播放flv视频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文