This thread is for questions for the tutorial "Setting up a timer on the server side to start an event".
Page: 1
Created on: 07/17/09 12:12 AM
Replies: 9
Graeme
Joined: 10/18/07
Posts: 1107
sabba77
Joined: 07/22/09
Posts: 4
RE: Setting up a timer on the server side to start an event
07/22/09 9:26 AM
Is it possible to use this to countdown to a LIVE event rather than just a premade video?
Let me give you a scenario...
Flash countdown to live event that happens everyday...after it reaches 0, it starts the live streaming from the encoder....once the event is over and the encoder stops, it goes right back to countdown.
Any help on this would be great!!
Graeme
Joined: 10/18/07
Posts: 1107
RE: Setting up a timer on the server side to start an event
07/26/09 11:27 PM
Sure. I don't see why you couldn't do that. It depends on the encoder of course, you can't tell FMLE to do that but you could have it publishing out all the time and then play that server side (which all the clients will be playing and waiting for) at the specified time.
javiadas
Joined: 11/12/07
Posts: 14
Graeme
Joined: 10/18/07
Posts: 1107
Goran
Joined: 09/22/09
Posts: 2
RE: Setting up a timer on the server side to start an event
09/22/09 1:25 PM
Since this is my firs post here I would like to thank you for another great tutorial!
I needed a script to set the exact date and time when the event starts, and I managed to do it with a couple of small modifications to timer script.
I'm posting it here for others to use, since you can, with this script, very easily create your broadcast schedule for hours, weeks, months or even years :) ahead, and be sure that it will start broadcasting right on time, even if you are not close to the computer.
application.onAppStart = function(){
//Check for curront server time every second
this.timer_int = setInterval(checkForEvent, 1000, this);
}
function checkForEvent(app){
// I added one hour to server time becuse server time is GMT and my local time is GMT+1.
var myDate = new Date();
var dateTime = (myDate.getDate() + "." + (myDate.getMonth() + 1) + "." + myDate.getFullYear()+ "," + (myDate.getHours() + 1) + ":" + myDate.getMinutes() + ":" + myDate.getSeconds());
// Set the event strat date and time
// Format is DD.MM.YYYY,HH.MM.SS
if(dateTime == "22.9.2009,21:42:10"){
clearInterval(app.timer_int);
app.createStream();
}else{
trace(dateTime);
}
}
application.createStream = function(){
this.pseudoStream = Stream.get("your_stream_name");
this.pseudoStream.play("your_video_name");
}
daneco
Joined: 11/05/09
Posts: 5
RE: Setting up a timer on the server side to start an event
11/05/09 2:47 PM
is there a way to add multiple video files to this code, so when the first video is done it plays whatever is next, then whatever is after that, like a video playlist,,
if anybody knows how to do this and/or the code it would be greatly appreciated
dcw
Joined: 11/05/09
Posts: 14
RE: Setting up a timer on the server side to start an event
11/16/09 8:40 AM
In example "Setting up a timer on the server side to start an event" Graeme menctions that in the past versions of FMS there is issue of timer canceling itself out and needed to be reset. Does anyone know if this is still an issue? Or, does the timers run as expected.
Specifically, if I start a timer in onAppStart will the time run for the life time of the instance or until clearInterval is called?
Goran
Joined: 09/22/09
Posts: 2
RE: Setting up a timer on the server side to start an event
11/17/09 9:33 AM
@daneco, this is an exsample:
this.pseudoStream.play("video_1", 0, -1);
this.pseudoStream.play("video_2", 0, -1, false);You can read more about this topic here:
@dcw: I run a modified version of this code and I didn't have any problems, everything works perfectly.
clearInterval() cancels the setInterval(), so if you call clearInterval() the timer will stop because there is no interval set for the timer anymore.
If you don't call clearInterval() the timer will run as long as the application instance is live.
For example in my application I don't call the clearInterval() because I use the timer with interval of 1 second to display the current server time on client-side. If I called it the timer clock would stop even though the application is still alive.
daneco
Joined: 11/05/09
Posts: 5
New Post
Please login to post a response.