PDA

View Full Version : mediastream in 4.2.0.1


bitwalker
02-24-2009, 06:40 PM
Hi there

I have been using OL 4.1.1 and recently started to move my app over to OL 4.2.0.1

But the new mediastream object, contains no
play, seek, record, broadcast, pause, close or stop methods.

The reference documentation has all been updated to reflect this, but the other documentation still has not . So I guess it is by design. but now I do not know how to do these things.

Can anyone help?

bitwalker
02-24-2009, 07:04 PM
Sorry, after checking, the play seek pause stop and close methods are there. (though not documented)

It is just the camera specific methods, broadcast and record which are missing.

Can anyone shed light on this?

ultrasaurus
02-25-2009, 04:38 AM
Apparently in the move to 4.2 a few methods were lost along the way. The docs are auto-generated from the source, so they aren't authoritative in this case. These methods are now back in "trunk" (see OpenLaszlo 4.2.X Nightly Build on the download page: http://www.openlaszlo.org/download ) The code isn't there yet for swf9. I've verified that recording works in swf8, but haven't yet tested broadcast.

Sarah

bitwalker
02-25-2009, 06:28 AM
that is great. thanks. I will look at it again on Friday when I get back to work.

J

bitwalker
03-03-2009, 08:21 PM
Well I had more problems but decided not to post back until I could really get into them.

The first thing is that these lines from mediastream.lzx throw compiler warnings
<switch>
<when property="$as3">
<passthrough>

I know why we need this switch and the passthrough, but I don't know how to keep the compiler happy. It says:
The passthrough tag can only be used in an
as3 runtime, perhaps you could put this in a switch tag?
However the main problem was that it was not recording audio or video. After more investigation than I wanted to do, I found the reason. In the cameras startdevice method it checks to see if it is a child of a videoview and if so, sets the videoviews camera property. But the check doesn't take into account the changes in Videoview as a result of the new setter tags. Because there is no longer a _setCam method, it assumes it is not a child of a videoview and no camera or microphone get set.

<method name="startDevice"><![CDATA[
// Use duck typing to check for the existence of the
// _setCam method, instead of checking if the
// immediateparent is an instance of videoview, to avoid
// loading the videoview class if it's not needed.

if (immediateparent['_setCam']) {
immediateparent._setCam(this);
}

super.startDevice();
]]>
</method>
The fix I applied was to just to replace the whole if clause with
immediateparent.setAttribute("cam",this);
I don't know how to do the ducktyping thing. Sorry. But some check needs to be done to establish if the camera is a videoview child.

Anyway, we are still not out of the woods because, Videoview has the same problem. It tries to set the _setCam method of mediastream, which no longer exists. So you will need to find this line:
function $lzc$set_cam(cam) {
this.cam = cam;

if (this['stream']) {
this.stream._setCam(cam);
}
}
And replace
this.stream._setCam(cam);
with
this.stream.setAttribute("cam",cam);

Then you will have to do all the above for the microphone as well.

I should really get a JIRA account, I suppose.

Justin

bitwalker
03-03-2009, 09:05 PM
I don't know what ducktyping is, butI found out how to check if the containing class is a videoview.

Use this in camera.lzx
if (immediateparent instanceof lz.videoview) {
immediateparent.setAttribute("cam",this);
}

And in microphone.lzx
if (immediateparent instanceof lz.videoview) {
immediateparent.setAttribute("mic",this);
}

ultrasaurus
03-04-2009, 08:58 AM
You have definitely found a bug or two. Can you please sign up for a JIRA account and file a bug or two? Max re-wrote the setters and understands the runtime checking stuff better than I, but he's in Japan so I don't think he's awake right now. If you write up the bugs, I'll ping him this evening and see if we can get this fixed.

Thanks for investigating and your detailed write up!

Sarah
http://www.ultrasaurus.com

ultrasaurus
03-04-2009, 09:01 AM
oops -- just saw your last post. I can fix that, but need a test case that causes the failure. Recording does work for me, but I see the bug in the code... I just want to be able to repro it so I can make sure the change really fixes the bug.

Thanks!
Sarah

bitwalker
03-04-2009, 06:55 PM
Thanks Sarah for all your help.

I just decided that there was too little information out there for people wanting to use red5. So I took a big gulp and posted my recorder application in the showcase forum just now.

You should be able to just load it up and go. I hope this helps as a test case, and also as a quick check that things aren't broken, and for other users to learn from or even use as is.

Justin

ultrasaurus
03-04-2009, 07:03 PM
Thanks for posting it. I will check out the app you posted. If you aren't already aware of it, the test cases for OpenLaszlo can be found here:
http://svn.openlaszlo.org/openlaszlo/trunk/test/video/

run-test.html is an index with some notes about what works and what doesn't (although the "updateAllowed" bug was fixed and it is still noted as broken in the index, oops)

I'm working thru them and fixing bugs that I find (since they all got broken with the 4.2 release -- eek!)

Sarah

bitwalker
03-04-2009, 07:43 PM
Oh wow that is great. I did not know about those test cases, but I am glad that I do now.

thanks.