rainbowcreatures / FlashyWrappers

AIR / Flash video recording SDK
17 stars 10 forks source link

PLATFORM_FLASH: FlashyWrappers with FWSoundMixer #32

Closed jkpatel1463 closed 6 years ago

jkpatel1463 commented 7 years ago

I developed a app for mobile by using Flashywrapper & FWSoundMixer for iPhone. It works fine. Now i am rewriting the app for web. use same flow of execution with flash specific SWC & SWF. when i call start method of FlashyWrapper it throws error which is written below. I google about the error but do not found any documentation about it(in you site + github).

Error: Error: [FlashyWrappers error] You're trying to add audio frames but you're not recording! Make sure you started the encoder with init and you're not trying to record after finishing.

stack trace:

[SWF] /MyCommUnityApp/assets/swfs/FW_SWFBridge_ffmpeg.swf - 7,109,214 bytes after decompression
[FlashyWrappers] Got encoder class from FW_SWFBridge_ffmpeg
[FlashyWrappers] Added to stage!
CModule::startAsync
     console: [object FWVideoEncoder]
     args: null
     env: null
     preserveStack: true
     isAutoSetRealThreadId: true
CModule::start
     console: [object FWVideoEncoder]
     args: 
     env: 
     preserveStack: true
VideoConvertionHelper - onStatus: ready
[SWF] /MyCommUnityApp/assets/swfs/FWSoundMixer_SWFBridge.swf - 2,852,476 bytes after decompression
[FlashyWrappers] Got FWSoundMixer class from FWSoundMixer_SWFBridge
VideoConvertionHelper.as - onMixerStatus: ready
Mixer ready, requesting Context3D...
SaveVideoScreen.as - onVideoInitCompleteHandler: 
SaveVideoScreen.as - startVideoRecord: 
SaveVideoScreen.as - initSound: 
SaveVideoScreen.as - recordVideo: 
SaveVideoScreen.as - onShowNextScreenAnimationHandler: 2
_firstLoader Obj -loader.width: 582, loader.height: 540, resizedObj.width: 582, resizedObj.height: 540
VideoConvertionHelper - onStatus: trace
[FlashyWrappers] Initializing...
CRun::newThread: 1,9441280,9812,7368784,21084,7344448
CModule::workerInit: 0 / 0

SaveVideoScreen.as & VideoConvertionHelper.as classes are written by me.

this helper class(VideoConvertionHelper.as ) and screen(SaveVideoScreen.as) working fine with iPhone. issues is for Flash platform only.

jkpatel1463 commented 7 years ago

Hello @rainbowcreatures

Is there any updates on it ?

rainbowcreatures commented 7 years ago

Hey, I didn't have a chance to read your question until now. Could you provide a sample project for this as well? The error is pretty straightforward, so not sure whats going on.

jkpatel1463 commented 7 years ago

Hello @rainbowcreatures It takes some time for me. so meanwhile preparing a sample projects. Is it possible to answer of these question. Error have some text ("You're trying to add audio frames but you're not recording! Make sure you started the encoder with init and you're not trying to record after finishing.") which try to explain the error cause, but i do not get it. so please give me the answer.

When this error was thrown ? can you give me its condition OR possible causes of these error.

rainbowcreatures commented 7 years ago

Well, the error should fire only if you are trying to record audio before you started FlashyWrappers video recording. That's why I said its straightforward. I'd need to inspect FWSoundMixer sources fully to see where any issue might be. FWSoundMixer has not been the focus lately (rather various Android/iOS encoding issues), that's why I can't figure out anything else from top of my head more details about your issue.

Please prepare your samples in Adobe Animate (or the earlier versions of Flash Professional). Thanks!

jkpatel1463 commented 7 years ago

Hello @rainbowcreatures

Here it is: https://www.dropbox.com/sh/u7ua140njt62mlo/AADiYi7mYESh2KDH0G_w_ljVa?dl=0

jkpatel1463 commented 7 years ago

Hello @rainbowcreatures have you found the issues in the demo app(sample)?

rainbowcreatures commented 6 years ago

Hi, I managed to take a full look at your source code. So the issue is what it says, you are starting the capturing too soon. You can call this method:

mySoundMixer.startCapture();

only after you get "started" event from FWVideoEncoder, not sooner. You are calling it right after calling start method on FWVideoEncoder, but that method is async (at least in Flash), it does some preparations on background thread before starting recording. Thats why there is the "started" event in FWVideoEncoder, it fires after the background thread in start method is finished. In other words, move your FWSoundMixer startCapture here:

            else if (e.code == "started")
            {
                _onStartCallback.call();
                mySoundMixer.startCapture();
                _captureArea.addEventListener(Event.ENTER_FRAME, onEnterFrame);
            }

I tested your swf with this changed and it doesn't produce the error anymore.