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"); 


  • 相关阅读:
    移动平台开发需要的记录(续)
    移动平台开发需要的记录
    Chrome浏览器被劫持
    记录一个GO安装问题
    记录开发环境配置 MySql(5.7.17)+EF6.x+VS2017(15.7.1)
    win7(x64)下安装cocos2d并编译安卓项目
    Xocde一次版本升级遇到的问题 (Code Sign Error)
    【转】SqlServer将没有log文件的数据库文件附加到服务器中
    [转]IIS6.0迁移至IIS7.0
    重置VS设置
  • 原文地址:https://www.cnblogs.com/happyday56/p/946221.html
Copyright © 2011-2022 走看看