我正在开发一个小型ActionScript3应用程序,用于将用户的摄像头和麦克风广播到RTMP源。
视频效果很好,但麦克风不起作用。 使用VLC播放RTMP源表示根本没有音频源,只有视频源。
服务器(Wowza)目前与其他流一起使用,所以问题不在这里。在此之前,还有一个在服务器上使用的Flash广播应用程序。
以下是代码:
// Connection code
// Code run after connected event on connection
var h264:H264VideoStreamSettings = new H264VideoStreamSettings();
h264.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_3_1);
outStream = new NetStream(connection);
outStream.videoStreamSettings = h264;
// Camera code
microphone = Microphone.getEnhancedMicrophone(0);
if( microphone )
{
var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions();
options.mode = MicrophoneEnhancedMode.FULL_DUPLEX;
microphone.enhancedOptions = options;
microphone.setLoopBack(false);
microphone.setUseEchoSuppression(true);
microphone.setSilenceLevel(0);
microphone.codec = SoundCodec.SPEEX;
microphone.encodeQuality = 10;
microphone.rate = 16;
microphone.gain = 75;
outStream.attachAudio(microphone);
}
outStream.publish( streamKey );