# Streaming a video from a specific cue point

**URL:** <https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523>\
**Category:** Wowza Streaming Engine\
**Created:** [January 7, 2009, 11:35am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523 "2009-01-07T11:35:03Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [January 7, 2009, 11:35am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/1 "2009-01-07T11:35:03Z")

</div>

I’d like viewers to be able to request just the portion of a video starting at a specific time or cue point. I’ve read that a Flash server can offer this, but don’t see any mention of how to do it.

Can anyone show me how to serve just part of a longer video?

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [March 17, 2009, 7:53am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/2 "2009-03-17T07:53:10Z")

</div>

Simplest code I could come up with:

```auto
import flash.media.Video;
var serverUrl:String = "rtmp://localhost/simplevideostreaming";
var nc:NetConnection;
var ns:NetStream;
var video:Video;
nc = new NetConnection();
video = new Video(320, 180);
stage.addChild(video);
function ncOnStatus(infoObject:NetStatusEvent)
{
	trace("ncOnStatus: "+infoObject.info.code);
	if (infoObject.info.code == "NetConnection.Connect.Success")
	{
		ns = new NetStream(nc);
		video.attachNetStream(ns);
		ns.bufferTime = 2;
		ns.play("Extremists", 10, -1);
	}
}
nc.addEventListener(NetStatusEvent.NET_STATUS, ncOnStatus);
nc.connect(serverUrl);

```

Charlie

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [January 7, 2009, 7:53pm UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/3 "2009-01-07T19:53:04Z")

</div>

You can do it with start and length parameters of netstream.play:

```auto
ns.play("somestream",10,20);

```

This will play “somestream” starting at 10 seconds from the start, and will play for 20 seconds.

Richard

---

<div class="post-metadata">

**Author:** ![Eric\_Engelmann](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@Eric\_Engelmann](https://community.wowza.com/u/Eric_Engelmann)\
**Post date:** [March 18, 2009, 11:50am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/4 "2009-03-18T11:50:24Z")

</div>

I finally figured out how to do something simple. I’ll post what I did so the next poor guy in my situation doesn’t have to spend three days floundering. If you need to stream only slices of a longer video from a Wowza server, here’s the simple way to do it.

I used the JW Player, which you can get and install from [http://www.longtailvideo.com/players/jw-flv-player/](http://www.longtailvideo.com/players/jw-flv-player/)

I put its files in a folder called /flash

I have a server with wowza at [http://afr-video](http://afr-video) (it’s on our intranet, so it won’t work for you).

I have a folder with the eiti.flv video file and an html file “afrex/test.htm” with just a few lines of code:

I’m playing just the part of eiti.flv starting at 839 seconds and continuing through 885 seconds.

This text will be replaced

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [March 17, 2009, 6:40am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/5 "2009-03-17T06:40:37Z")

</div>

If you want a simple, powerful and nice looking player then take a look at JW Player. The instructions are here:

[http://community.wowza.com/t/-/33](http://community.wowza.com/t/-/33)

If you want to learn how to program Flash with Wowza Pro yourself then I would take the time to dissect the SimpleVideoStream example player. It actually is not super complex.

Also, take a look at this tutorial. It covers the basics:

[http://blog.martinlegris.com/?p=94](http://blog.martinlegris.com/?p=94)

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [March 18, 2009, 6:07am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/6 "2009-03-18T06:07:47Z")

</div>

Follow these instructions:

[http://community.wowza.com/t/-/33](http://community.wowza.com/t/-/33)

Charlie

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [March 12, 2009, 8:18pm UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/7 "2009-03-12T20:18:02Z")

</div>

Eric,

I suggest the working examples that ship with Wowza here:

[wowza-install-dir]/examples

Check out the simplevideostreaming example, open the FLA file with Flash, go to the layer 1 actionframe, and look for the NetStream and NetConnection, and how to connect and play videos. It’s all working already in these examples and you can modify them and use them.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [March 17, 2009, 2:37pm UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/8 "2009-03-17T14:37:48Z")

</div>

The “ns” or “nsPlay” parts in the examples are both NetStream/s The could be any name. Look for this:

var ns:Netstream = new NetStream(nc);

nc is a NetConnection.

You are the right track. The play command you posted will play a slice of a video.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [March 17, 2009, 3:58pm UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/9 "2009-03-17T15:58:23Z")

</div>

JW player handles “start” using seek after a video starts playing, instead of in the NetStream.play command.

Open com.jeroenwijering.models.RTMPModel.as. Look for this:

```auto
stream.play(url);

```

I changed it to:

```auto
var start:String = model.playlist[model.config['item']]['start'];
start = (start=="")?"0":start;
stream.play(url,start,-1);

```

The “start” time would come from a playlist. You could add a length arg the same way, and just add a length value in playlist.

In the function onData, comment out these lines:

```auto
//if(model.playlist[model.config['item']]['start'] > 0) {
//	seek(model.playlist[model.config['item']]['start']);
//}

```

Richard

---

<div class="post-metadata">

**Author:** ![Eric\_Engelmann](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@Eric\_Engelmann](https://community.wowza.com/u/Eric_Engelmann)\
**Post date:** [January 7, 2009, 12:24pm UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/10 "2009-01-07T12:24:24Z")

</div>

> You can do it with start and length parameters of netstream.play:
> 
> ```auto
> ns.play("somestream",10,20);
> 
> ```
> 
> This will play “somestream” starting at 10 seconds from the start, and will play for 20 seconds.
> 
> Richard

Thanks! I know that what you wrote is ActionScript, and I’ve already done some simple edits (when directed) of ActionScript in Flash CS3 Prof, but I don’t know how to create code when my player (FLVPlayback) doesn’t include it. I don’t even know how to define a stream. Is that just my FLV file name?

With Real’s Helix Server, I’d just add parameters to the end of the URL for a video file, eg. rtsp://afr-video/speech.rm?start=2:35&end=4:55

Surely it can’t be as difficult to do this in Flash as it seems. Designers wouldn’t make something so basic so difficult.

---

<div class="post-metadata">

**Author:** ![Eric\_Engelmann](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@Eric\_Engelmann](https://community.wowza.com/u/Eric_Engelmann)\
**Post date:** [March 12, 2009, 10:25am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/11 "2009-03-12T10:25:13Z")

</div>

> You can do it with start and length parameters of netstream.play:
> 
> ```auto
> ns.play("somestream",10,20);
> 
> ```
> 
> This will play “somestream” starting at 10 seconds from the start, and will play for 20 seconds.
> 
> Richard

Sorry, but really have no idea what to do with that piece of code. If I have a video and a player, what do I do? I really know nothing about how to assign code to an object, or whatever it is one needs to do. I don’t know what a “netstream”. I spent two hours on the Adobe actionscript tutorial and it never described how to make a video play from a specified point. I just want to play a part of a longer Flash video.

---

<div class="post-metadata">

**Author:** ![Eric\_Engelmann](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@Eric\_Engelmann](https://community.wowza.com/u/Eric_Engelmann)\
**Post date:** [March 17, 2009, 5:36am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/12 "2009-03-17T05:36:46Z")

</div>

> Eric,
> 
> I suggest the working examples that ship with Wowza here:
> 
> [wowza-install-dir]/examples
> 
> Check out the simplevideostreaming example, open the FLA file with Flash, go to the layer 1 actionframe, and look for the NetStream and NetConnection, and how to connect and play videos. It’s all working already in these examples and you can modify them and use them.
> 
> Richard

Thanks.

I had already gotten the simplevideostreaming example to work. I was able to select the Layer 1 in the simplestreamingvideo.fla file, and to open the Actions Window. There I was able to find some entries that used NetStream, but none that looked anything like this:

ns.play(“somestream”,10,20);

Did the author mean “nsplay”?

The following looked a bit like it might be related, since the comment above it indicated it’s about playing a video. I don’t see how this relates to the suggestion above, though.

nsPlay.seek(timecode);

I think the problem I have is that this simplevideostreaming example is actually quite complex. I appreciate that the market for Wowza in the past has been for technical professionals, but I don’t want to become a Flash guru, I just want to play clips from our vast collection of long-tail Knowledge Management videos. Could I beg someone to create a REALLY, REALLY, REALLY simple (“hello world” level) example of playing a video from a defined time?

Thanks!!

---

<div class="post-metadata">

**Author:** ![Eric\_Engelmann](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@Eric\_Engelmann](https://community.wowza.com/u/Eric_Engelmann)\
**Post date:** [March 17, 2009, 7:39am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/13 "2009-03-17T07:39:37Z")

</div>

> If you want a simple, powerful and nice looking player then take a look at JW Player. The instructions are here:
> 
> [http://community.wowza.com/t/-/33](http://community.wowza.com/t/-/33)
> 
> If you want to learn how to program Flash with Wowza Pro yourself then I would take the time to dissect the SimpleVideoStream example player. It actually is not super complex.
> 
> Also, take a look at this tutorial. It covers the basics:
> 
> [http://blog.martinlegris.com/?p=94](http://blog.martinlegris.com/?p=94)
> 
> Charlie

Thanks!

I looked at the JW Player article, but I don’t see anything there indicating play start/stop times.

I tried the code in the blog (I had to rename one of the video variables, since Flash told me there was a conflict), and got my video to play, but the blog doesn’t seem to be using the Wowza server, just http, so I can’t play just one clip from a long video.

I really don’t want to invest the time to learn how to program Flash, since I have no need to do so. Really, all I want is to play defined clips from long videos, using just the simplest possible player. That’s it.

I feel like a guy trying to explain to General Motors why it would be a good idea to offer a radio as an option in their cars. I keep getting steered towards “how-to” magazines.

If I _EVER_ get this working, I promise to create a documented “hello world” example. It could become famous.

---

<div class="post-metadata">

**Author:** ![Eric\_Engelmann](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@Eric\_Engelmann](https://community.wowza.com/u/Eric_Engelmann)\
**Post date:** [March 17, 2009, 7:46am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/14 "2009-03-17T07:46:33Z")

</div>

> The “ns” or “nsPlay” parts in the examples are both NetStream/s The could be any name. Look for this:
> 
> var ns:Netstream = new NetStream(nc);
> 
> nc is a NetConnection.
> 
> You are the right track. The play command you posted will play a slice of a video.
> 
> Richard

Really? GREAT!

How would I modify this line to play one slice, perhaps starting at 10 seconds and ending at 30?

nsPlay.seek(timecode);

In its present form, it looks like it’s just a seek method for nsPlay to move the play head to the time of “timecode” (I hope I got the Flash lingo correct).

---

<div class="post-metadata">

**Author:** ![Eric\_Engelmann](https://avatars.discourse-cdn.com/v4/letter/e/5daacb/32.png) [@Eric\_Engelmann](https://community.wowza.com/u/Eric_Engelmann)\
**Post date:** [March 18, 2009, 5:58am UTC](https://community.wowza.com/t/streaming-a-video-from-a-specific-cue-point/523/15 "2009-03-18T05:58:25Z")

</div>

I discovered that the JW Player works great and does exactly what I need! I just use their player and the code below. Because my videos are all very long and bandwidth to the World Bank’s country offices iin Africa is expensive, I’d prefer to stream just what they need using Wowza. Can this fabulous JW Player work with Wowza as simply as it does with http? Using rtmp to try to get video from Wowza instead of http doesn’t seem to work.

This text will be replaced
