Video Recording from Browser using Flash, PHP, Red5

混江龙づ霸主 提交于 2019-12-05 14:19:05

Check this: http://www.actionscript.org/resources/articles/615/2/Getting-started-with-red5-server/Page2.html

It explains how to connect and use RED5 and gives you an example.

Octavian Naicu

Here's the exact AS3 code for publishing video from Flash to a media server like Red5, Wowza or AMS:

//init vars
public var nc:NetConnection;
public var ns:NetStream;

//net connection to media server
nc = new NetConnection();
nc.connect("rtmp://yourmediaserver/oflaDemo/instance");

//net stream through which the recording  data is sent
ns =  new NetStream(nc)

//attach cam and mic to net stream
ns.attachCamera(Camera.getCamera())
ns.attachAudio(Microphone.getMicrophone())

//send the data to the media server
ns.publish("streamName","record");

For just audio comment the ns.attachAudio line .

Flash Player can't encode mp3 sound (it can decode). You'll get sound encoded with NellyMoser ASAO. Speex is also an option. See this answer for more details.

oflaDemo is a Red5 app that supports video recording that's shipped with Red5.

For a (commercial) Flash/HTML video recording solution that supports Red5 and PHP you should check out https://hdfvr.com.

Also, what do I need to do so that I can store the video according to the user.

Just execute a PHP script (from the Flash client) that saves the info in the database. You can use POST or GET to send the video data and sessions or cookies to retrieve the user data.

Siva
var video:Video;
var camera:Camera = Camera.getCamera();
camera.addEventListener(ActivityEvent.ACTIVITY, active);
video = new Video();
video.attachCamera(camera);

function active(event:Event):void
 {
  addChild(video);
  camera.removeEventListener(ActivityEvent.ACTIVITY, active);
 }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!