Help with MTASC and SWFMill for CamCanvas

645 views Asked by At

Hey folks wondering if you can help me.

I am trying to compile locally the following: https://github.com/taboca/CamCanvas-API-

This is camcanvas a javascript api for a webcam. Anyhow - its build.sh remakes the swf for which the javascript makes calls to.

I git clone the repository and having installed mtasc and swfmill run ./build.sh

the build.sh file looks like this : https://github.com/taboca/CamCanvas-API-/blob/master/build.sh

This creates a new swf in the swf folder, however it is sized at 869 bytes and does not work, whereas the swfs in the examples folder are 1.89 KiloBytes and do work....so something must be going wrong with my build process.

When I go to try the new swf, the page does not ask me to allow the camera and microphone - it simply does not show any video at all.... help!

Can somebody please try to do what I have done and see if they can determine what I am doing wrong.

Thanks,

Andy

2

There are 2 answers

0
fred On

It's not usable with the script that they provide:

swfmill simple library.xml camcanvas.swf
mtasc -version 8 -swf camcanvas.swf -main camcanvas.as

But it's usable if you update the original camcanvas with:

copy Originalcamcanvas.swf camcanvas.swf
mtasc -version 8 -swf  camcanvas.swf -main camcanvas.as

With the 2 process, the size of camcanvas.swf is 819 bytes

If you decompile with: swfmill swf2xml camcanvas.swf >camcanvas.txt

You have 2 similar text file with 968 lines with 2 differences:

Line 14 : DefineSprite objectID="**1**" frames="1" ==> DefineSprite objectID="**2**" frames="1"

Line 21 : Symbol objectID="**1**" name="ObjetVideo" . . . . ==> Symbol objectID="**2**" name="ObjetVideo"

And it’s enough to block the Flash.

I didn’t find the good correction of “library.xml”. So if you have an idea…

0
icyrock.com On

This seems to be a bug in the code. Better yet, the swf files in the samples/* folders seem to be compiled from a different source then what's currently on github.

Anyway, here are the comments I have on the situation:

  • On a clean project checkout, I also get the file of 869 bytes, so your situation is correct
  • You seem to be comparing swf files from v0.1 to v0.2. If you look in the samples folder, all the swf files are exactly the same, except the one in samples/red-0.2. The version in the filename gives it away, anyway. This file has 868 bytes (darn, that one byte...), but except having a similar size it doesn't seem to be content-similar (i.e. the diff between this and the file I generated was pretty big content-wise)

As I'm not very well versed in as2 myself, I could not figure out what exactly is a problem, but I found the following link:

which, on a side note, seems to be doing pretty much the same thing as this project and seems worth looking at.

I could make it work by changing this: - Take the xml from the above link and replace the contents of library.xml file in the root of the project with that (I left the first xml line, but should work without that) - Change the following lines in the src/camcanvas.as

_root.attachMovie("ObjetVideo", "webcamVideo", 1);
_root.webcamVideo.attachVideo(_root.cam);

with the following:

var display = _root.attachMovie("VideoDisplay", "display", 1);
_root.webcamVideo = display.video;
display.video.attachVideo(_root.cam);

A hacky combination, but... If you build this with the build.sh script, you should get a 897-byte swf that should work.

Note that you must use the html from the red-0.2 sample folder and you must first click on Get the Camera List button, then change the camera (just pick the second (empty) item and go back to first, which should have a name of your camera as known to the system) in the combo box that gets populated. After you do this, you should get the Allow/Deny dialog from Flash (unless you explicitly enabled this) and it should work perfectly after that.

Also, on my machine it did not work from the file stored locally - I had to put this on a (local) Web server to get it working. It probably has to do with the security restrictions. Keep that in mind if you try it in a similar way.

Hope this helps.