zoukankan      html  css  js  c++  java
  • FlashCom+&Asp/Asp.Net 实现WEB视频聊天

    要安装 flashcom 测试版本可以在media上下载。

    代码如下:

    [JaSoft.Aspx]

    <%@Language="C#"%> 
    <script runat="server"> 

    private void Page_Load(object sender, System.EventArgs e) 

    Response.Write("conn=1&Sendid="+Session["ziyan"]+"&Recvid="+Session["sammi"]); 

    </script> 


    [View.Aspx]

    <%@ Page Language="C#" %> 
    <script runat="server"> 

    private void Page_Load(object sender, System.EventArgs e) 

    Session["ziyan"]=Request.QueryString["RecvId"]; 
    Session["sammi"]=Request.QueryString["Sendid"]; 

    </script> 
    <html> 
    <head> 
    <meta http-equiv="Content-Language" content="zh-cn"> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    <title>无标题文档</title> 
    </head> 

    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <div align="center">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-44553540000" 
    codebase= http://download.macromedia.com/pub/shockwave
    /cabs/flash/swflash.cab#version=6,0,29,0 width="500" height="500">
    <param name="menu" value="false">
    <param name="movie" value="JaSoft.swf">
    <param name="quality" value="high">
    <embed src="JaSoft.swf" quality="high" pluginspage=
    http://www.macromedia.com/go/getflashplayer 
    type="application/x-shockwave-flash" width="500" height="500"> </embed></object>
    </div>
    </body> 
    </html> 

    [JaSoft.Swf]

    stop(); 
    myCam = Camera.get();
    myVideoObject.attachVideo(myCam);
    myCam.onStatus = function(infoMsg) {

    if(infoMsg.code == "Camera.Muted"){
    _root.a.text="User denies access to the camera";
    }
    else
    System.showSettings(0);
    }


    client_nc = new NetConnection(); 

    client_nc.onStatus = function(info) { 
    trace("Level: "+info.level+newline+"Code: "+info.code); 
    _root.abc.text = "Level: "+info.level+newline+"Code: "+info.code;
    }; 

    client_nc.connect("rtmp://192.168.25.18/record_video"); 

    rec_so = SharedObject.getRemote("myvideo", client_nc.uri, true); 


    rec_so.connect(client_nc); 
    var Recvid; 
    var Sendid; 
    GetId(); 
    function Recv() { 

    in_ns = new NetStream(client_nc); 

    in_ns.play(Recvid); 
    _root.b.attachVideo(in_ns); 


    function Send() { 
    this.cam = Camera.get(); 
    this.mic = Microphone.get(); 
    out_ns = new NetStream(client_nc); 

    out_ns.attachVideo(this.cam); 
    _root.a.attachVideo(this.cam); 

    out_ns.attachAudio(this.mic); 
    out_ns.publish(Sendid, "live"); 


    function GetId(){ 
    myload = new LoadVars(); 

    myload.action = "post"; 

    myload.onLoad = function(success) { 

    if (success) { 

    if (this.conn == "1") { 
    _root.Recvid = this.Recvid; 
    _root.Sendid = this.Sendid; 
    Send(); 
    Recv(); 
    _root.abc.text =’ok...’; 

    } else { 
    //如果和服务器连接不成功则返回失败消息,需要检查路径是否正确 
    _root.abc.text = ’连接不成功....’;

    }; 
    myload.sendAndLoad("http://192.168.25.18/Asp.Net/JaSoft.aspx", myload, "post"); 


  • 相关阅读:
    英文网站优化之十个非常不错的Zen Cart插件
    kindeditor4.0.4个性化修改
    C#线程从陌生到熟悉(1)
    c# 关于LISTBOX的添加项的问题 以及不重复插入
    CSS设置字体为楷体
    SqlServer2005安装成功后补加Sa用户
    c# winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值
    实例讲解如何把表格变量传递到存储过程中
    StringBuilder
    初学基于.net三层架构的ERP系统(1)
  • 原文地址:https://www.cnblogs.com/happyday56/p/946221.html
Copyright © 2011-2022 走看看