Hello, Robert!

There is a demo called "videolibrary" that shows how to use the streaming server (red5 or fms) and the camera to record live webcam videos on the server, which should work with red5 or Flash Media Server.

Here's the url of the videolibrary demo running on my server, which is running Flash Media Server and has a few demo videos, and permits you to record your own videos:

http://www.donhopkins.com:8080/trunk/demos/videolibrary/videolibrary.lzx?lzt=swf

If you run it an click the camera icon, a recording drawer opens up with a Record button. If the camera hasn't been enabled yet, it will say "Camera Disabled. Click to Change.", and you can click there to bring up the Adobe Flash Player Settings dialog, and click "Allow". Then you can press Record and it will upload a video stream from your web camera to the server, and when you press Stop, it will refresh the list of videos, including the one you just recorded at the end of the list.

There is not currently any way to edit the title, description or icon time over the web, or delete videos, but you can do that on the server by editing properties in text files. It's left as an exercise for someone to add access control and editing and administration functions like that to the user interface.

Here is the video camera panel user interface:

http://www.donhopkins.com:8080/trunk/demos/videolibrary/videocamerapanel.lzx?lzt=source

Here's the videotogglebutton in the videocamerapanel that switches between record mode and stop mode when you press it, by doing all the funky stuff with the camera and media stream:

       <videotogglebutton name="recordbutton"
           x="${(parent.width - this.width) / 2}"
           y="${(parent.topHeight - this.height) / 2}"
           resource="${this.engaged ? 'stop_btn' : 'record_btn'}"
           visible="${classroot.cam.allowed}"
       >

           <handler name="onengaged"><![CDATA[
               if (this.engaged) {
                   classroot.ms.stop();
classroot.ms.close(); // FIXME: being paranoid, because it keeps writing over the last stream played.
                   classroot.cam.setAttribute("show", true);
                   var v = classroot.videomaker.makeNewVideo();
                   classroot.ms.setAttribute("type", v.type);
                   classroot.ms.setAttribute("url", v.url);
                   classroot.ms.record();
               } else {
                   classroot.ms.stop();
                   //classroot.cam.setAttribute("show", false);
                   classroot.cam.setAttribute("show", true);
                   var v = classroot.videomaker.doneRecording();
               }
             ]]>
           </handler>

       </videotogglebutton>

The videoplayer has a build-in mediastream, and a built-in videoview, which itself has a build-in camera and microphone. The videolibraryplayer fishes the camera and microphone out of the videoplayer "vp", which has a videoview subview named "vscreen", who has a mediastream named "ms" and a videoview named "vv". So the videolibraryplayer's this.vp.vscreen.ms is the mediastream, and this.vp.vscreen.vv is the videoview, which has a .cam and a .mic attribute. (The user interface classes define short-cut attributes that refer to the various objects they need, so they don't depend on the layout of the user interface or the names of other views. So videocamerapanel has attributes for cam, mic and ms that its parent configures). It's pretty nifty how it makes the thumbnails using the streaming server, because it was so easy! Instead of using static image files as thumbnails, the videothumbnail class uses the media server (red5 or fms) to seek to a particular time and retrieve a single frame of video. You can write text files with metadata for each video that has a title, description, and the time in seconds to use for the thumbnail frame. The videothumbnail makes an icon for the video by using a mediastream with autoplay and setting autoplayStart to the thumbnailtime, and autoplayLength to 0, which (thanks to the wonders of declarative programming) automatically seeks to the icon time and freezes the video (in that way, red5 and the flash media server support randomly seeking to any time and retrieving a single frame).

http://www.donhopkins.com:8080/trunk/demos/videolibrary/videolibrarythumbnail.lzx?lzt=source
http://www.donhopkins.com:8080/trunk/lps/components/av/videothumbnail.lzx?lzt=source

Here's how the mediastream and videoview in the videothumbnail are configured with autoplay attributes, to seek to the thumbnailtime and stop:

<mediastream name="ms" debug="true" autoplay="true"
           autoplayStart="${classroot.thumbnailtime || 0}"
           autoplayPause="false"
           autoplayLength="0"
           autoplayReset="true"
type="${classroot.type}" url="${classroot.url}"
       />


<videoview name="vv"
           x="${parent.border}"
           y="${parent.border}"
           width="${parent.width - (2 * parent.border)}"
           height="${parent.height - (2 * parent.border)}"
           type="${classroot.type}"
           stream="$once{classroot.ms}"
           playvolume="0.0"
       />


Also, the YouTube demo has some parameters you can pass in the URL:

empty=1 brings up the player empty
featured=1 brings up the player with a list of YouTube's featured videos
tag=foo,bar brings up the player with a the results of searching for the list of tags (space, comma or semicolon delimited)
user=foo brings up the player with a list of the user's videos
with none of the above parameters, it brings up the player with a tag search for "guitar", which is usually pretty good stuff.

   -Don


Jim Grandy wrote:
Can either of you answer this question from a user?

(Don, I never told you, but your YouTube is now a featured demo on the openlaszlo.org home page.)

jim

Begin forwarded message:

*From: *Robert Pieprzny <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
*Date: *April 3, 2007 3:06:39 AM PDT
*To: [EMAIL PROTECTED] <mailto:[email protected]>
*Subject: **[Laszlo-user] Camera - 4.0*
*Reply-To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

Hi !

Have you any example of use Camera in OL 4.0 ?

I found one with Red ! But I am looking for something better !


Robert
PCG


Reply via email to