Recording output volume from machine using flash - actionscript-3

I successfully created an application where i can record microphone sound using flash and then save that stream to a server called "Red5" .
But lately i came across a strange requirement of capturing the output volume from machine and then saving that stream to red5 server.Like if i listen to a song or a skype call or listening to any other sound.I just want to capture those sounds.
I searched for this sort of situation just to get an headstart but i havent found any solution so that i can proceed with it.
Can anyone here provide a start up solution for this.
Can this be done through flash?Or any other way ?
Any help will be appreciated.Please provide suggestions
Thanks

Certainly there are ways to get this done, however using Flash as is I don't see it being possible (most likely a security concern, don't want ads arbitrarily recording peoples conversations).
Programs like Audacity are capable of recording off of the StereoMix output of a computer which is essentially what you're asking about. You could potentially build an AIR app that includes an ANE that packages the functionality from Audacity, but would require quite a bit of porting and... well time.

Related

Record videoconference application to flv

I've spent plenty of time solving this problem, but it looks like I need some help. I have a web conference application which provides ability to stream live video, chat, share documents, draw on a whiteboard, share desktop, etc. And now I want to record everything that happens in taken separately so called webinar, including video and sound. So I'm looking for tools that can help with this goal.
Here's input data:
This is Adobe Flash based application
Using wowza server
Everything should be recorded on server
Many webinars can be in recording mode at the same time
Record should be represented in video (flv, mp4 or whatever)
What I've done so far and what I problems I have:
I have implemented recording on server side. But this is not a video, this is just a list of commands to recreate passed webinar. It works, but has lot's of limitations and problems with rewinding.
And now I'm testing this FLV Encoding library. I created AIR application that starts on server when record is needed, connects to taken webinar and takes screenshots from itself with BitmapData.draw() method. Works pretty neat, but has some limitation that I'm looking help with:
First of all, this is sound problem. I have no idea how to catch all
sounds from all sources in flash. So far from my tests and googling I conclude that SoundMixer.computeSpectrum() won't help me to do this. Maybe this can be done on server side by mixing all streams on the right time but I think this can lead to synchronization problems and I prefer to capture sound on client. Maybe there is way to capture audio byte array from rtmp stream somehow?
Security problems. We have 2 kinds of them. First ones are with streaming videos. BitmapData.draw() method throws exeptions even after adding <StreamAudioSampleAccess>true</StreamAudioSampleAccess>
<StreamVideoSampleAccess>true</StreamVideoSampleAccess> on server. There are lots of posts about this problem and no good solution.
But more complex problem is that YouTube videos can be opened in webinar using api player. And in this situation I have no idea how to resolve security problem. Maybe someone knows a way or workaround to use BitmapData.draw() on YouTube AS3 player?
Or maybe there is another good way to solve my recording issue?
Free Apache Openmeetings conferencing [1] has a java recording application inside which should work in 3.0 release. Just use it.
[1] http://openmeetings.apache.org/

Netstream - how to publish an mp3 file using RTMFP

I want to publish a mp3 file from one of the peers and play it from other peers, very similiar to a RTMFP chat app.
From what I understand till now:
netstream.publish is used to publish a stream to RTMFP netconnection and netstream.play for playing a stream from other peers.
The steps for streaming mic and camera capture are:
netstream.attachCamera(cam);
netstream.attachAudio(mic);
netstream.publish('video');
However I don't see a way to publish (stream) mp3 files using Netstream. Note that using Netstream is essential since I want to "publish" audio to listening peers.
Please correct me if I was wrong above. Ideally what I want to achieve should be easily possible, yet I can't find any pointers for it. Is is possible to use ByteArray for the same. Any alternative streaming strategy would be welcome as long as it works with RTMFP. Links to code examples would be great too.
You stumbled upon one of the strange quirks of NetStream. It can publish sound from the microphone, but not from a arbitrary sound source. There is some workarounds, some more complex than the others.
Streaming through a virtual microphone. The easiest workaround, and the best (IMO) if your project allows you to use it. You just have to install a virtual microphone/camera software (ex : ManyCam) and use it to stream your mp3 file(s) through a virtual microphone. With that done, you just have to bind this microphone to your AS3 app. Sadly, it doesn't work for your project, since you can't reasonably ask of the publishing peer to install a virtual microphone.
Streaming usingSound.extract(), NetStream.send() and SampleDataEvent.SAMPLE_DATA. As you might know, NetStream.send() can be used to send messages to peers. The thing is, those messages are serialized and can be ByteArray. Thus, you can send audio data samples with NetStream.send(). The publishing pee apps can obtain the data samples with Sound.extract(), and the receiving apps can play them thanks to the SAMPLE_DATA event. One of the problems will be to know when you should send new samples. To manage that, you would recommend also using the SAMPLE_DATA in the publishing app and send new data each time the SAMPLE_DATA event occurs. The main issue with this method is that since you don't use the standard way of RTMP to stream audio, it needs a custom app for the receiver to play it. Given what you said of your project, it shouldn't be a problem.
Reproducing the RTMFP protocol using Socket. It would be long, very complex, and error-prone. I would never recommend to do this except perhaps as a learning experience. You would need to read, understand and implement most of the RTMFP Specification.

How can I use Flash to remember user data?

I am making a Flash game that stores user's statistics from previous sessions. I would also like to maintain some sort of leader board as well.
After I posted, I realized I was asking the wrong question. I feel that shared objects are the proper solution to this problem rather than using a database. Any further feedback for implementing shared objects is welcome.
Thanks for any feedback.
You can not directly query MySQL database table from Flash game, you must have some server-side technology backing you up for the job.
I would suggest using some PHP or Ruby - or whatever is easily available to you for the job.
Flash is going to be rendered on Client browser (as swf) and won't be in touch with server as it will be served as a static resource by the web browser.
I hope this reply will help you moving towards right direction.
As Dharmavir mentioned, you cannot process MySQL queries through Flash (AS*).
That said, its pretty easy to setup Flash to communicate with remote scripts, as it has the ability to POST/GET data through requests.
There are many tutorials on this.
First, write a simple script to input the data into the DB. I recommend using PHP (I think its the easiest to learn tbh).
If this is your first time performing queries with PHP, I also recommend using Prepared Statements instead of mysql_*.
Once you have your script setup, you can then move onto processing a request from your flash app to your script (which is also pretty easy).
I found a tutorial series on making a chat app with flash and PHP. The tutorial includes making requests to PHP scripts and inputting data to SQL DBs, so it should help you:
http://www.youtube.com/watch?v=XeWKauwFUEQ < This tutorial is split into many different videos. take a look at the suggestions to find the others.

Post-processing captured video in AS3, creating slow motion

I have an interesting project wherein I need to allow users to capture video of themselves with a webcam at a kiosk, after which I email them a link to their video. The trick is the resulting video needs to be a 'slow motion' version of the captured video. So for example, if someone creates a 2 minute movie, the resulting movie will be 4 minutes.
I'd like to build this in Flex / AS3 if possible. I don't have issues capturing the video and storing it / generating and emailing a link, but slowing down the video is the real mind bender. I'm unsure how to approach 'batch post-processing' a set of videos using Adobe tools.
Has anyone had a project similar to this or have suggestions on routes to take in order to do this?
Thanks!
-Josh
This is absolutely feasible from the client side, contrary to what some may believe. :)
http://code.google.com/p/flvrecorder/
Just adjust the capture rate, which shouldn't be too difficult all the source is there.
Alternatively, you could write an AIR app that launches Adobe Media Encoder after writing a file and launch it with a preset that has FTP info etc. Or you can just use the socket class to connect and upload over FTP.
http://code.google.com/p/fl-ftp/
It is not feasible to do this client-side.
Capture the video and send it to the server.
Use a library like FFMpeg to do your coneversions

Flash CS4/AS3 Writing local file from local game without save dialog prompt?

I'm writing a game to be run locally, on the user's computer. NOT over the internet.
I want to have a file that will hold the usernames and avatar indices (they're in an array).
I want to know if there's a way to write to files through Flash with AS3. I'm using CS4.
I'd also like to know if you can delete files through Flash, though that's just optional.
Thanks in advance for any help you can give.
If you want to make a game that runs locally on someone's computer, you should make it in Adobe AIR. AIR apps can read and write files, and do all sorts of useful things like show updates in the taskbar, etc. Whereas a simple SWF that you download and run locally can't do anything useful that it couldn't already do in the browser - it can't write or delete local files, for a start. (It can read local files, but only if you disable it from accessing the network.) Moreover, the standalone Flash player is not generally disseminated, so unless the user is a Flash developer they're just going to view your SWF in a browser anyway (unless you plan to publish projectors, which I also wouldn't recommend).
With all that said, however, even if you do your game as local flash content, you can still store information by using SharedObjects. They work the same way offline as online. You can't write the data out as a separate file, but you can store it between sessions easily enough.
if i understand what you are trying to do then why dont you use Adobe AIR? this is flash for the desktop