Live stream RTMP/RTSP player without using webview (WOWZA server) on Android

前端 未结 3 795
萌比男神i
萌比男神i 2020-12-12 13:11

I am developing an Android application in which I want to publish as well as stream a video...

What I want is:

  1. My app records a video and that video

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 13:48

    I am using Adobe AIR to play RTMP and it's awesome. I found the answer here; see the code:

    function init_RTMP():void
    {
        streamID  = "RT_2";
        videoURL = "rtmp://fms5.visionip.tv/live/RT_2";
    
        vid = new Video();
    
        nc = new NetConnection();
        nc.addEventListener(NetStatusEvent.NET_STATUS, onConnectionStatus);
        nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
        nc.connect(videoURL);
    }
    
    private function onConnectionStatus(e:NetStatusEvent):void
    {
        if (e.info.code == "NetConnection.Connect.Success")
        {
            trace("Creating NetStream");
            netStreamObj = new NetStream(nc);
    
            metaListener = new Object();
            metaListener.onMetaData = received_Meta;
            netStreamObj.client = metaListener;
    
            netStreamObj.play(streamID);
            vid.attachNetStream(netStreamObj);
            addChild(vid);
        }
    }
    

提交回复
热议问题