In this article, I am going to tell you that how can we develop
online monitoring system with the help of C# Asp.Net, SQL Server and FMS (Flash Media Server).
Suppose that you are in any meeting to any other-places or on any tour from
where you can't know what's going on in your office or in your home.
For use of this application we need two web cameras, one is for
capture activities and other is monitor activities from where do you want show (may
be your mobile phones or your Computer System).
Ok friends, now I am going tell you that how
can you easily develop this application. I will be explaining all steps one by one,
and you can also download this demo project from download here
Step 2- swfs file should be in route.
Setp 3-This is the .aspx page on which streaming video will be display.
<%@ Page Language="C#"
AutoEventWireup="true"
CodeFile="videoplayer.aspx.cs"
Inherits="videoplayer"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Live</title>
<meta http-equiv="Content-Type"
content="text/html;
charset=utf-8" />
<SCRIPT TYPE="text/javascript">
<!--
//Disable
right click script
//visit
http://www.rainbow.arch.scriptmania.com/scripts/
var message
= "Sorry, right-click has been disabled";
///////////////////////////////////
function
clickIE() { if (document.all) { (message); return false; } }
function
clickNS(e) {
if
(document.layers ||
(document.getElementById && !document.all)) {
if
(e.which == 2 || e.which == 3) { (message); return
false; }
}
}
if
(document.layers)
{ document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = clickNS; }
else {
document.onmouseup = clickNS; document.oncontextmenu = clickIE; }
document.oncontextmenu = new Function("return
false")
// -->
</SCRIPT>
<SCRIPT TYPE="text/javascript">
<!--
//Disable
select-text script (IE4+, NS6+)
//visit
http://www.rainbow.arch.scriptmania.com/scripts/
///////////////////////////////////
function
disableselect(e) {
return false
}
function
reEnable() {
return true
}
//if IE4+
document.onselectstart = new Function("return
false")
//if NS6
if
(window.sidebar) {
document.onmousedown = disableselect
document.onclick = reEnable
}
// -->
</SCRIPT>
<style type="text/css">
td img {display: block;}body {
background-color:
#191919;
}
a:link {
text-decoration:
none;
color: #F00;
}
a:hover {
text-decoration:
underline;
color: #F00;
}
a:visited {
text-decoration:
none;
color: #F00;
}
a:active {
text-decoration:
none;
color: #F00;
}
</style>
<!--
functionality -->
<script type="text/javascript"
src="scripts/swfobject.js"></script>
<script language="javascript">
var
queryParameters = new Array();
var flashVars
= "";
var tag = "";
var url = "";
window.onload = function ()
{
document.getElementById( 'inputURL' ).value = queryParameters['source'];
document.getElementById('embedField').innerHTML = tag;
for(var i=1 ; i<=10;i++)
{
var ids =
String("sel"+i.toString());
document.getElementById( ids
).style.visibility = "hidden";
document.getElementById( ids ).className = "style76";
}
// mark the
entry for that index
if(queryParameters['idx'] != "")
{
document.getElementById("td" + queryParameters['idx'] ).className = "style75";
document.getElementById("sel" + queryParameters['idx'] ).style.visibility = "visible";
}
}
function
initialise()
{
function
getUrlParam( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var
regexS = "[\\?&]"+name+"=([^&#]*)";
var regex
= new RegExp( regexS );
var
results = regex.exec( window.location.href );
if( results
== null )
return "";
else
return
unescape( results[1] );
}
queryParameters['source']
= getUrlParam('source');
queryParameters['type']
= getUrlParam('type');
queryParameters['idx']
= getUrlParam('idx');
if(
queryParameters['source'] == "" )
queryParameters['source']
= "rtmp://localhost/vod/mp4:sample1_500kbps.f4v";
if(
queryParameters['type'] == "" )
queryParameters['type']
= "recorded";
if(
queryParameters['idx'] == "" )
queryParameters['idx']
= "2";
flashVars += "&src=";
flashVars += queryParameters['source'];
flashVars += "&autoHideControlBar=";
flashVars += unescape("true");
flashVars += "&streamType=";
flashVars += queryParameters['type'];
flashVars += "&autoPlay=";
flashVars += unescape("true");
flashVars += "&verbose=";
flashVars += "true";
var
soFlashVars = {
src: queryParameters['source'],
streamType: queryParameters['type'],
autoPlay: "true",
controlBarAutoHide: "true",
controlBarPosition: "bottom"
};
tag = "<object
width='640' height='377' id='StrobeMediaPlayback' name='StrobeMediaPlayback'
type='application/x-shockwave-flash'
classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ><param
name='movie' value='swfs/StrobeMediaPlayback.swf' /> <param
name='quality' value='high' /> <param name='bgcolor'
value='#000000' /> <param name='allowfullscreen' value='true'
/> <param name='flashvars' value= '"+
flashVars+"'/><embed
src='swfs/StrobeMediaPlayback.swf' width='640' height='377'
id='StrobeMediaPlayback' quality='high' bgcolor='#000000'
name='StrobeMediaPlayback' allowfullscreen='true'
pluginspage='http://www.adobe.com/go/getflashplayer' flashvars='"+ flashVars +"' type='application/x-shockwave-flash'>
</embed></object>";
<!-- For version detection, set to min.
required Flash Player version, or 0 (or 0.0.0), for
no version detection. -->
var
swfVersionStr = "10.3.0";
<!-- To use express install, set to
playerProductInstall.swf, otherwise the empty string. -->
var
xiSwfUrlStr = "swfs/playerProductInstall.swf";
var params =
{};
params.quality = "high";
params.bgcolor = "#000000";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var
attributes = {};
attributes.id = "StrobeMediaPlayback";
attributes.name = "StrobeMediaPlayback";
attributes.align = "middle";
swfobject.embedSWF("swfs/StrobeMediaPlayback.swf",
"flashContent", "320", "240",
swfVersionStr, xiSwfUrlStr, soFlashVars, params, attributes);
<!-- JavaScript enabled so display the
flashContent div in case
it is not replaced with a swf object. -->
swfobject.createCSS("#flashContent",
"display:block;text-align:left;");
}
function
playStream()
{
var url = "source=" + document.getElementById('inputURL1').value;
var type;
if(document.getElementById('vodCheckbox').checked==true)
type="vod";
else
type="live";
url += ("&type="
+ type);
document.getElementById('playBtn').href="videoplayer.aspx?"
+ url;
}
function
checkbox(type)
{
if(type=="vod")
{
if(document.getElementById('liveCheckbox').checked==true)
{
document.getElementById('liveCheckbox').checked=false;
}
}
if(type=="live")
{
if(document.getElementById('vodCheckbox').checked==true)
{
document.getElementById('vodCheckbox').checked=false;
}
}
}
initialise();
</script>
</head>
<body><form id="form1" runat="server">
<table width="330px" height="250px" border="0" align="left" cellpadding="0" cellspacing="0">
<!--
fwtable fwsrc="080715_fms_splash_fireworks.png"
fwbase="index.gif" fwstyle="Dreamweaver" fwdocid =
"1526025482" fwnested="0" -->
<tr>
<td>
<td align="left"><div
style=" float:left; padding-right:20px;">
<asp:DropDownList ID="inputURL1" runat="server" onchange="javascript:playStream();"><asp:ListItem value="rtmp://172.168.116.150/vod/mp4:sample1_1500kbps.f4v">Noida</asp:ListItem>
<asp:ListItem value="rtmp://122.168.116.126/live/livestream">New
Delhi</asp:ListItem>
</asp:DropDownList>
</div><div style=" float:left; padding-right:20px;"><a
id="playBtn"
onclick="javascript:playStream();"><img src="images/playstream_10.gif" width="104" height="25" /></a>
</div> <div style="display: none;">
<input name="inputURL" type="text" id="inputURL"
/> <input type="checkbox" name="checkbox" id="vodCheckbox" checked
onclick="checkbox('vod');"
/> <input type="checkbox" name="checkbox2" id="liveCheckbox" onclick="checkbox('live');" /></td>
</div>
</td>
</tr>
<tr valign="top">
<td height="327" colspan="3" bgcolor="#191919"><map
name="index_r4_c3MapMap"
id="index_r4_c3MapMap">
<area shape="rect" coords="32,160,308,181" href="fms_adminConsole.htm" target="_blank"
/>
<area shape="rect"
coords="316,161,433,181"
href="#"
/>
</map>
<map name="index_r2_c4MapMap" id="index_r2_c4MapMap">
<area shape="rect" coords="20,21,55,61" href="http://www.adobe.com" target="_blank"
/>
</map>
<map name="index_r4_c3Map" id="index_r4_c3Map">
<area shape="rect" coords="32,160,308,181" href="fms_adminConsole.htm" target="_blank"
/>
<area shape="rect" coords="316,161,433,181" href="#" />
</map>
<map name="index_r2_c4Map" id="index_r2_c4Map">
<area shape="rect" coords="20,21,55,61" href="http://www.adobe.com" target="_blank"
/>
</map>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4" align="left"
bgcolor="#191919"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--
Here goes the StrobeMediaPlayback -->
<td valign="top">
<!--
SWFObject's dynamic embed method replaces this alternative HTML content with
Flash content when enough
JavaScript and Flash plug-in support is
available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>To view this
page ensure that Adobe Flash Player version 10.3.0 or greater is installed.</p>
<script type="text/javascript">
var
pageHost = ((document.location.protocol == "https:")
? "https://" : "http://");
document.write("<a
href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif'
alt='Get Adobe Flash player' /></a>");
</script>
</div>
<noscript>
<a href="http://www.adobe.com/go/getflashplayer/" style="color:black"><img src="images/ERROR_getFlashPlayer.gif" width="640" height="377"
/></a>
</noscript>
</td>
</tr>
</td>
</tr>
</table></td>
</tr>
</table></form>
</body>
</html>
No comments:
Post a Comment