It is currently 27 Jun 2017, 04:44



Flash Server Connection

Help to specific problems with your setup, or discussing CasparCG bugs

Moderators: Macey, Jonas Hummelstrand, didikunz

Flash Server Connection

Postby silid » 09 Dec 2016, 14:42

Hi

I'm creating a flash template which needs to synchronise with videos.

I am using the Server Connection library and I am able to start the videos, but due to the irregular delay, sometimes the flash precedes the video by as much as a second.

What I am trying to do is preload my video before the animation starts, then play it.
How can I know when each command has completed? Ideally I'd like an onComplete function but I don't think there is a way to tie a response from CasparCG to a request.

What methods do you use to do this sort of effect?

Thanks.
silid
 
Posts: 37
Joined: 23 Apr 2014, 14:48

Re: Flash Server Connection

Postby silid » 09 Dec 2016, 15:17

I've put a stop() on the first frame and a play() in the onConnected event and that seems to create reliable performance, but I can't seem to get the other events to fire (onSuccess, or onSendCommand).
silid
 
Posts: 37
Joined: 23 Apr 2014, 14:48

Re: Flash Server Connection

Postby didikunz » 09 Dec 2016, 16:20

I use an SSD for Caspars Media (and Template) folder. That makes the video-delay very constant.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3478
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Flash Server Connection

Postby sonny_xny » 14 Dec 2016, 09:27

silid wrote:Hi

I'm creating a flash template which needs to synchronise with videos.

I am using the Server Connection library and I am able to start the videos, but due to the irregular delay, sometimes the flash precedes the video by as much as a second.

What I am trying to do is preload my video before the animation starts, then play it.
How can I know when each command has completed? Ideally I'd like an onComplete function but I don't think there is a way to tie a response from CasparCG to a request.

What methods do you use to do this sort of effect?

Thanks.


You can using "NetStream" method in ActionScript v3.0 to do the immediately video playing without waiting for loading all full video content.

Please check this link :

http://help.adobe.com/en_US/FlashPlatfo ... tream.html

if you want to know when the video is ready just using this simple function

Code: Select all
function VideoStatusChange(stats:NetStatusEvent) {
    if (stats.info.code == 'NetStream.Buffer.Full') {
        // do playing or do something
    }
}


but, I think if you are using NetStream method to playing your video, you will not need a preload animation, because the video always playing immediately using the data from the video buffer.

You can prevent your video player from being "stop or pause for loading content", by edit the function into this :

Code: Select all
var ns:NetStream;

function VideoStatusChange(stats:NetStatusEvent) {
    if (stats.info.code == 'NetStream.Buffer.Full') {
        // do playing or do something
    } else if (stats.info.code == 'NetStream.Play.Start') {
   ns.pause();
   if (ns.bufferLength >= ns.bufferTime || ns.bytesLoaded == ns.bytesTotal) {
      ns.resume();
   }
    } else if (stats.info.code == 'NetStream.Buffer.Empty') {
   ns.pause();
   if (ns.bufferLength >= ns.bufferTime || ns.bytesLoaded == ns.bytesTotal) {
      ns.resume();
   }
    }
}


that's code makes your video buffer always full :)

NB : for more detail, you can search in Google.com using this link :

https://www.google.co.id/?gws_rd=ssl#q= ... deo+player

Cheers,
Sonny
User avatar
sonny_xny
 
Posts: 112
Joined: 06 Jul 2015, 08:59

Re: Flash Server Connection

Postby didikunz » 14 Dec 2016, 20:05

Sonny, while what you write is interessting, you both talk about two different things: You talk about a videoplayer embedded in the template, while he is trying to make Caspar play the video on another layer, outside of the template.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3478
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Flash Server Connection

Postby sonny_xny » 15 Dec 2016, 03:32

didikunz wrote:Sonny, while what you write is interessting, you both talk about two different things: You talk about a videoplayer embedded in the template, while he is trying to make Caspar play the video on another layer, outside of the template.


Hi Didi,

using "NetStream" method wich means you can playing video file from external source of the flash template, for simple way, you just put the URL video (it can be declare from full path local video file) into a XML file and then the flash template just read the XML file to load the video file.

So the example that came from Adobe :

http://help.adobe.com/en_US/FlashPlatfo ... lesSummary

can be modified to load the video file from external XML file.

If you want to playing other video file, just change the URL in the XML file and then reload the flash template again :) so you don't need to "rebuild / recompile" the flash template or you don't need to embed the video file into flash template :)

Cheers,
Sonny
User avatar
sonny_xny
 
Posts: 112
Joined: 06 Jul 2015, 08:59

Re: Flash Server Connection

Postby didikunz » 15 Dec 2016, 10:24

For an example of a template, that plays a Caspar video see this: https://www.dropbox.com/s/k3bq0wd4n73i8n5/Fasnacht_Bauchbinde.zip?dl=0. What is missing is the actuall video. It's encoded as QuckTime, with animation codec and alpha channel. It's huge. The problem here was, that the background clip had movement to the end, so it was not possible to stop the file after the into animation. That's why it has a timer, that takes the template out before the video is finished. For animations that are intro - frezze - outro I try to import them into Flash as PNG sequence (only the area of interesst) and put them in a movieClip. Or I use two videofiles, one for the intro, that frezzes in the end and one for the outro. The outro clip will be preloaded in the play() handler, so that it reacts fast. And the SSD for the media folder helps to keep the latency and tolerance to a minimum.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3478
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Flash Server Connection

Postby sonny_xny » 15 Dec 2016, 13:21

Well, you can trying my project called "VSUB Movie Controller" :

viewtopic.php?f=3&t=4068&p=27163

On the flash template I am using "NetStream" method, I even can playing HD 1080 movie file (MP4) which having file size about 2 Gigabytes and the flash template didn't need any preload animation, it just "direct" playing the movie without waiting one or two second :)

Cheers,
Sonny
User avatar
sonny_xny
 
Posts: 112
Joined: 06 Jul 2015, 08:59


Return to Help & Support

Who is online

Users browsing this forum: No registered users and 2 guests