Wowza Community

How to pause a stream from the server end ?

Hi All,

I am using wowza + jw player for streaming. it’s kind of a pay per view app, where I keep track of user’s time spent watching.

I am trying to create pause events every X minutes so that we can ensure he’s actually watching the video.

i tried

(stream.getPlayer()).pause(IMediaStreamPlay.PAUSE_PAUSE, 0);

and

stream.setIsPlaying(false)

but this gets the player into buffering mode and it gets stuck. btw, what’s the second parameter in IMediaStreamPlay.pause(), is it the offset at which the player is to be paused ? i am looking for something that just pauses the player as soon as the command reaches from server to jw player, not quite interested in an offset.

i dont have any knowledge about flash streaming but i guess pause event is triggered by NetStream.Pause so i tried these as well,

stream.send(“NetStream.Pause”);

and

sendClientOnStatusError(stream.getClient(), “NetStream.Pause”, “Press Play to continue”);

but nothing happened.

Can someone please help me with pausing the player from server side ?

Thanks,

RaBelle

You’re going to want to pause the stream on the player side. Look into the flash documentation for how to do that. Or, check out one of the Wowza simple video streaming examples. You can set a timer in Flash to have the stream paused after a certain amount of time.

If you want to control pausing from the Server side. You will need to use Remote Procedure Calls. From the server, using RPC, you’ll send a message that will run a certain function (your pausing function) on the Flash client. See the User Guide for examples of Bi-directional Remote Procedure Calls.

Also take a look this example of IMediaStreamActionNotify3.

https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info

The onPauseRaw event corresponds to NetStream.pause. (Don’t use onPause)

Some PPM and PPV systems use IMediaStreamActionNotify interface to track time, but it only works for Flash RTMP clients. Looking back at logs is easier and not limited to Flash RTMP clients. You can track usage for users in the logs following this guide:

https://www.wowza.com/docs/how-to-track-streaming-by-users

Richard

Chris,

Take a look at these guides:

https://www.wowza.com/docs/how-to-log-to-a-mysql-database

https://www.wowza.com/docs/how-to-log-to-a-postgresql-database

Richard

I am looking for something similar to this. I want to track “view count” on a video, but I want to make sure a view time threshold is met before it’s considered “viewed”. If Wowza can write a log file for any activity on any protocol why is this not made available through events/methods? Dredging through logs seems like a back-door unnecessary approach. Is there an option to send log entries to a database with the fields delimited? Is this a feature to be considered for a future release?

Thanks for considering,

Chris

Look into the flash documentation for how to do that. Or, check out one of the Wowza simple video streaming examples. You can set a timer in Flash to have the stream paused after a certain amount of time.

if it’s possible for you, could you please point me to this tutorial. i assume you are talking about modifying the jwplayer and i have no knowledge of as3, so it’d be great if you could point me to the right place where to begin

If you want to control pausing from the Server side. You will need to use Remote Procedure Calls. From the server, using RPC, you’ll send a message that will run a certain function (your pausing function) on the Flash client. See the User Guide for examples of Bi-directional Remote Procedure Calls.

i suppose, this should be easier to implement but still i’d need to modify the jwplayer to add the pause routine, are any examples that i cana refer, esp pertaining to jwplayer

I was able to work the player, taking pointers from this tutorial http://www.longtailvideo.com/support/forums/jw-player/player-development-and-customization/24988/simple-doubleclick-for-fullscreen-code

Just in case, someone has a similar problem