Flash and multimedia (sound) files without a media server

Is it possible to record a sound clip directly on a linux server using a flash script without a flash server?

+3
source share
1 answer

use MicRecorder . The following happens on the project website.

To record sound from a microphone in an application, just use a few lines:

// volume in the final WAV file will be downsampled to 50%
var volume:Number = .5;
// we create the WAV encoder to be used by MicRecorder
var wavEncoder:WaveEncoder = new WaveEncoder( volume );
// we create the MicRecorder object which does the job
var recorder:MicRecorder = new MicRecorder( wavEncoder );
// starts recording
recorder.record();
// stop recording
recorder.stop();

When recording starts, the RecordingEvent.RECORDING event is dispatched giving time information. When it is recorded, Event.COMPLETE sending stops, allowing you to retrieve Micorder.output bytes and save the audio stream (in this case as WAV) using a simple FileReference object:

recorder.addEventListener(RecordingEvent.RECORDING, onRecording);
recorder.addEventListener(Event.COMPLETE, onRecordComplete);

private function onRecording(event:RecordingEvent):void
{
     trace ( event.time );
}

private function onRecordComplete(event:Event):void
{
     fileReference.save ( recorder.output, "recording.wav" );
}

, , WAV WavSound as3wavsound:

private function onRecordComplete(event:Event):void
{
     var player:WavSound = new WavSound(recorder.output);
     player.play();
}

MicRecorder , MicRecorder:

// a specific Microphone instance can be passed
var recorder:MicRecorder = new MicRecorder( wavEncoder, microphoneDevice );
+3

Source: https://habr.com/ru/post/1775972/


All Articles