Adding cue points to NetStream
Hello I have been working on a project and have loaded videos using netstream. I have several cue points that advance the timeline to a certain keyframe. Would anyone have the script for NetStream that would do this, for example, when the video reaches cue1 it would advance the timeline to frame 10?
Thank you so much for your help.
mark.
Since no one has yet posted on this, I'll re-post part of a response to another post which deals specifically with using cue points with a NetStream video player:
OK, here is a working NetStream cue point:
var ns:NetStream = new NetStream(nc);
video_screen.attachVideo(ns);
/* Name of your video, with correct path, goes here */
ns.play("my_video.flv");
ns.onCuePoint = function(evt:Object){
trace(evt.name);
trace(evt.time);
if(evt.name == "jump_100") {
trace("YO !Jump to 100!");
gotoAndStop(100);
Reading this code:
set a new variable "ns" which is a new NetStream
attach a video to "video_screen"... the instance name of the video on the stage
now use that variable "ns" to play a video with file name "my_video.flv"
use ns to listen for an "event" type cue point Object
when the cue point is detected trace the event name and time
if the event name is exactly equal to "jump_100"
then trace "YO !Jump to 100!"
and then gotoAndStop at frame 100
For this exact code to work, your NetStream variable must be named "ns"
In the video you play, there must be a cue point of the "Event" type with the name "jump_100"
There must be at least 100 frames in the timeline.
Take it in small steps;
First make sure you can play the video using NetStream ... that's all.
Next, add the trace to detect the cue point... if you can't detect it, of course it won't do anything.
Only after you can successfully play the video and detect the cue point, should you attempt the cue point action (jump to frame 100).
You can also add more "if" statements if there are multiple cue points.
If cue point 1, then do this.
If cue point 2, then do this.... etc.
Best wishes,
Adninjastrator
Similar Messages
-
I've created a custom object without the FlvPlayback
component. I used the following code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
myVid.attachVideo(ns);
ns.play("flv/home/intro.flv");
That flv file has embedded cue points. How do I access them?
I can access them easily if I were using the FlvPlayback component,
but I don't think the cue points are getting through the netstream.
Any ideas?use the ns.onCuePoint event handler.
-
VideoPlayer and adding Cue Points
I'm having a tough time getting cue points to work with the new sparks VideoPlayer. In the documentation, it states that VideoDisplay has been replaced with VideoPlayer, but most of the examples on the web are for VideoDisplay.
I'm calling the usual 2 classes from the mx namespace.
import mx.events.CuePointEvent;
import mx.controls.videoClasses.CuePointManager;
then trying to dynamically add cue points like this:
I then create an instance of the CuePointManager, with myVid [type sparks VideoPlayer]
cuePointManager = new CuePointManager(myVid);
then create a new cuePt Objectwith name and time properties and try to add it as a cue point:
myVid.myCuePointManager.addCuePoint(cuePt);
where
- myVid is the VideoPlayer instance
- myCuePointManager is an instance of CuePointManage
- cuePt is an Object with name and time
I get errors about cooercing myVid [type sparks VideoPlayer]
1067: Implicit coercion of a value of type spark.components:VideoPlayer to an unrelated type mx.controls.videoClasses:VideoPlayer
1119: Access of possibly undefined property cuePointManager through a reference with static type spark.components:VideoPlayer
Can someone please be very kind and give me a nudge in the right direction. I've been pulling my hair on it for a day now, and couldn't find any tutorials specifically on the new sparks VideoPlayer and how to add dynamic cue points to it.
Thanks,
David
P.S. Video is big on the web. I would say that sorting out the VideoPlayer should be one of the top priorities in the new version of the SDK.The short answer (and the official one) is that our new Spark VideoPlayer doens't support cuePoints.
The longer answer is that as OSMF (Open Source Media Framework, which is what the Spark VideoDisplay/VideoPlayer components ship with) adds cue point support, you might be able to take a newer build of OSMF and start using cue points. Here's some info on OSMF and cuePoints: http://blogs.adobe.com/osmf/2009/11/cue_point_support_in_osmf.html . You could try taking one of their recent builds and playing around with it. In order to bring those classes in to Flex, I'd probably reccomend monkey-patching on top of spark.components.VideoDisplay and changing a few things as some of the underlying OSMF APIs that Flex is dependent on have probably changed. Then, you'd have to look at how to expose cuePoints from the spark VideoDisplay component.
-Ryan -
Tried adding cue points via as3 code but haven't been able to find anyway to accomplish this task. Read allot places that when you load a video via netStream you can't add cue points with actionscript. The only way is to embed the cue points is into the video. But this is not an obtain for me since someone else does the videos and they may change or be modified at some time. I can add actionscript cuePoints with the FLVPlayback component but I am looking for ways of increasing video performace.
By the way what is the difference\advantage of using netStream over using the FLVPlayback component? Often wander this but haven't read anything to say one is better then the other when running video over the web.
ThanksThanks kglad. Being able to customize is always better in my flash world. LOL
I'll have to stay with the FLVPlayback component as long as I have to use cue points in my videos.
Thanks -
I have a flv which im loading in from another location (ie
its not embeded), and Im trying to create a loop point using cue
points.
I have 3 cue points: begining, loop_point, end
Basically when the playhead reaches the "end" cuepoint, I
want it to jump back to "loop_point"
Can anyone help? I have a deadline for monday to get this
finished!Pewee2000,
> Oh sorry I get what you mean now. Yeh I imported without
> player and used seperate componants from the flv custom
> playback UI panel to control the movie.
Okay, I'm not exactly clear on what you just said, so I'm
going to
proceed as if you're using the FLVPlayback Component. Here's
the scoop on
using ActionScript. Just about everything is an object.
Objects are simply
"things" that behave a certain way. Movie clips are objects,
buttons are
objects ... FLVPlayback Component instances are objects --
you get the idea.
:) Objects are defined by something called classes. Think of
a class as a
given object's blueprint. You'll genearally see up to three
categories in a
class: properties, methods, and events. Properties are
characteristics an
object has, such as a movie clip's width and height. Methods
are things an
object can do, such as movie clip's ability to gotoAndPlay()
some frame.
Events are things an object can react to, such as a mouse
click.
In your case, the FLVPlayback events include a cuePoint
event. You can
see detailed information -- often including sample code --
for all the
properties, methods, and events of the FLVPlayback class by
looking up the
phrase "FLVPlayback class" in the Components Language
Reference right in the
built-in Help documentation. Component classes are listed in
this
reference, and normal classes are listed in the ActionScript
2.0 Language
Reference. In the AS Language Reference, the three categories
are combined
in each class entry, but for some reason the Components
Language Reference
separates them. But you'll see 'em when you look up the
class.
You'll want to take things slow and start with a *simple*
example.
Assuming you've added cue points through the Component
Inspector panel, your
FLV will honor those cue points during playback. Start your
journey by
looking up the cuePoint event in the "Event summary" section
for the
FLVPlayback class.
You'll see this:
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
// insert event-handling code here
my_FLVplybk.addEventListener("cuePoint", listenerObject);
... which may look scary if you're not a coder, but it works
like this:
first, a variable named listenerObject is delcared as a
generic Object
isntance. This object is your "ambassador" for the
FLVPlayback instance,
which features the cuePoint event. You assign a function to a
new cuePoint
property of your generic object. This function will be
executed when any
cue point occurs. Finally, you use the addEventListener()
method to
"subscribe" your FLVPlayback instance to the generic object,
listenerObject.
Now you're "listening" for cue points.
In the above example, the instance name for your FLVPlayback
instance
must be my_FLVplybk -- but you can make it whatever you like,
as long as the
ActionScript matches the instance name.
Where it says "// insert event-handling code here," you may
want to use
a trace function ...
trace("Here's a cue point!");
... just to prove to yourself that it works. Read up in the
documentation,
and you'll see that the eventObject object received by the
function contains
valuable information about the FLVPlayback instance that
dispatches the
cuePoint event. You can trace eventObject.target, for
example, and get a
reference back to your FLVPlayback instance.
trace(eventObject.target);
That reference would let you refer to the FLVPlayback
instance and
invoke FLVPlayback methods on it, such as your various seek
options for
looping.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
FLV Cue Points from Soundbooth
I am having a strange issue. I have several audio files that I have opened in Sounbooth and added cue points. I saved the files as FLVs. Upon importing into Flash CS4 with the FLVPlayback component, my cue points are not loading. The component inspector shows "cuePoints: None". In a test I did before the New Year, the cue points loaded fine. I have no idea what I did differently this time. Any ideas? I know I can add the cue points in the FLVPlayback component, but I'd rather be able to do it in Soundbooth.
Thank you!This is an annoying work around, but here's how I got the cue points from Soundbooth to be recognized in Flash:
Opened the original MP3 in Soundbooth
Added my markers/cue points
Saved As ".AVI"
Saved again as ".F4V" (not FLV)
Imported the F4V into the FLVPlayback component
NOTE: If you add a new cue point to the FLV and try to resave as the same file name, the latest cue point will not import into Flash. I had to do yet another save as and pick a new file name.
Going to try to eliminate the AVI step, but note hopeful.
Hope this helps others. -
Cue points - Non-Component-based, NetStream class to gotoAndPlay?
Hello all,
I am trying (unsuccessfully) to utilse cue points in my flv (my_video) to jump to places in my timeline. My flv's are placed within a movieclip if this is helpful? I've learnt alot from this website (Goldmine for anyone needing help) http://www.quip.net/blog/2007/flash/how-to-use-flash-video-cue-points
but i just don't know enough about coding to get it to work. I've done a trace of my flv and this is the information it came back with;
onCuePoint:
parameters =
web1: website1
type = event
time = 3.009
name = web1
onCuePoint:
parameters =
web2: website2
type = event
time = 10.127
name = web2
onCuePoint:
parameters =
web3: website3
type = event
time = 17.866
name = web3
I've tried to 'fudge' my way through this but don't understand the language?! I exprted the flv with embeded cue points called web1, web2 & web3 and am trying to get these to jump to the main timeline (out of the mc) to their respective labels (web01, web02 & web03) Whilst I was embedding those cue poitns i also added event names (also web1, 2 & 3) and values of website1,website2 & website3 -no idea why just thought they had to be filled?
Just to reiterate i'm not using components and I am using the net stream class.
Help!
...please!
Here's my code so far;
ns.onCuePoint = function(evt:Object):Void {
trace(evt.name);
trace(evt.time);
trace(evt.parameters);
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
// Put any code you like here
trace("web1: " + eventObject.info.name);
trace("event: " + eventObject.info.type);
if(eventObject.info.name=="web1"){
gotoAndStop("web01");
my_video.addEventListener("cuePoint", listenerObject);Thanks kglad. Being able to customize is always better in my flash world. LOL
I'll have to stay with the FLVPlayback component as long as I have to use cue points in my videos.
Thanks -
Revision: 11238
Author: [email protected]
Date: 2009-10-28 12:45:35 -0700 (Wed, 28 Oct 2009)
Log Message:
Cue point sample improvements and added a work around for FM-171 to the TemporalFacet class.
Ticket Links:
http://bugs.adobe.com/jira/browse/FM-171
Modified Paths:
osmf/trunk/apps/samples/framework/CuePointSample/src/CuePointSample.mxml
osmf/trunk/framework/MediaFramework/org/osmf/metadata/TemporalFacet.asRevision: 11238
Author: [email protected]
Date: 2009-10-28 12:45:35 -0700 (Wed, 28 Oct 2009)
Log Message:
Cue point sample improvements and added a work around for FM-171 to the TemporalFacet class.
Ticket Links:
http://bugs.adobe.com/jira/browse/FM-171
Modified Paths:
osmf/trunk/apps/samples/framework/CuePointSample/src/CuePointSample.mxml
osmf/trunk/framework/MediaFramework/org/osmf/metadata/TemporalFacet.as -
Cue points in dynamically loaded flv file through netstream
How can i add cue points to a playlist of flv files which are
loaded dynamically through an xml files. All the sources i have
found over the internet are using flvplayback control :(Lestyn, thanks for the verification. Took me a frantic 4 hours to arrive at the same conclusion. Do these people test their software???
Maddening. -
In FLVPlayback working in as2.0, created cuepoints for FLV and i added
captions wit xml file. but captions not loading
I did following steps and script.
*step1: layer 1 for flvplayback
*step2:layer2 for dynamic text(instance name-txtCaption)
step3: layer3 for actions and the script is
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
//ns.play("speech.flv");
ns.onMetaData = function(oMeta:Object) {
trace("onMetaData >");
trace("\tNumber of cue points: "+oMeta.cuePoints.length);
for (var i:Number = 0; i<oMeta.cuePoints.length; i++) {
var oCue:Object = oMeta.cuePoints[i];
trace("\t\t"+i+": "+oCue.name+", "+oCue.type);
var captionsXML:XML = new XML();
captionsXML.ignoreWhite = true;
captionsXML.onLoad = function():Void {
captions = this.firstChild.childNodes;
for (var i:Number = 0; i<captions.length; i++) {
ns.addASCuePoint(captions[i].attributes.start,captions[i].firstChild.
nodeValue);
captionsXML.load("cuecaption.xml");
ns.addEventListener("cuePoint",onCuePoint);
function onCuePoint(evntObj:Object):Void {
txtCaption.text = evntObj.info.name;
XML script
<?xml version="1.0" encoding="iso-8859-1"?>
<captions>
<caption start="00.000">Black-eyed susans</caption>
<caption start="38.082">Echinacea</caption>
<caption start="42.275">hello.......</caption>
<caption start="56.250">hi.........</caption>
<caption start="56.250">hi.........</caption>
</captions>
Plz reply me....
Regards,
PriyaDid you have any luck finding an answer to your question??? I am having the same kind of problems with my presentation. But the difference is that my presentation is in AS 3. Please look at my post here:
http://forums.adobe.com/message/2178119#2178119
Please let me know if someone can figure this out!!!
Thx.
Nit -
Hi,
I was hoping that someone could help me out with this. I have
a SWF that plays a FLV with actionscript cue points that when the
cue point is reached the timeline plays. I need the cue points
variables (the timecode) to be loaded from a text file because non
Flash users will be adding content. The problem is that I can get
it to work with putting the variables in the actionScript. But if I
load the variables from the text file the playhead will not play
with the cue point is reached. Below is the code that I am using.
Thanks in advance.I'm sure there is more than one way to skin this cat, but here is what I use with NetStream video to load other .swfs (could be photos or other videos) at certain points in the main video:
ns.onCuePoint = function(evt:Object){
trace(evt.name);
trace(evt.time);
if(evt.name == "play_vid1") {
trace("YO!Loading wide_holder!");
wide_holder.loadMovie("rm/images/black_bear.swf");
if(evt.name == "play_vid2") {
trace("YO!Loading standard_holder!");
standard_holder.loadMovie("rm/images/sqis.swf");
in this case using an "event" cue point object embedding at certain times in the video.
Lots of info on the Web, here is just one:
http://www.communitymx.com/content/article.cfm?cid=124DB
Best wishes,
Adninjastrator -
Hi there,
I'm a total newb to this forum, so hello adobe premiere community! I'm perplexed by Adobes documentation on Premiere (and I'm sure I'm not the first ) anyway on the live documents page below:
http://livedocs.adobe.com/en_US/PremierePro/3.0/help.html?content=WS9390BED7-9466-46ea-A0E A-3240F1AFC36C.html
it states that:
“The cue point data in the Chapter field of a sequence marker in Adobe Premiere Pro will be encoded as Flash XML. For the XML protocol required, see Flash Help.”
Which is great…except this information doesn’t exist seemingly in either the Premiere documentation or Flash either for that matter, but as I’m interested in working with the chapter/marker area in Premiere – should I really be told to go off and search the documentation for another application, probably not! What would have been useful would have been a code snippet saying you do it like this, but of course, that would make things too easy!
Basically, I understand that in After FX you can add Flash marker information specifically for interpretation when exporting to Flash Video (i.e. name, type and parameters etc) and it suggests that you can do the same above in Premiere CS3 using some kind of concatenated string in the chapter area…it just doesn’t tell you how anywhere seemingly – WHY ADOBE!
Currently when I export markers as cue points based on the advice in the page above, anything I put in the chapter section to force Premiere to create a cue point is converted to a string, which becomes the cue point ‘name’.
This cue point name is then automatically appended to the ‘time’ the marker was inserted at and is always encoded as type ‘navigation’, with no obvious means of adding ‘parameters’ into the equation.
So (finally) does anyone know if you can insert this information into the chapter area for correct interpretation by flash (i.e. thus allowing you to choose between either 'navigation' or 'event' types, and pass as many 'parameters' as you wish etc) or are you just limited to supplying a name, and it being automatically set to the navigation type with no parameters?
I’m sorry for this long essay but at least the issue is well defined for you to answer, honestly any help you can provide what so ever would really be most appreciated!
Best regards,
Kat
PS – I have utterly no knowledge of XML either just in case you were wondering – and my only interest in XML is getting this basic information encoded into the FLV file from Premiere Pro CS3! Please help, pretty please with daisy’s!!!Hi dradeke,
Thanks for your reply, which is indeed useful as clearly Adobe have made this task easier and less obscure in CS4 by adding simple interface functionality, however I'm stuck with using CS3 for the moment. Its not majorly a problem as the video material in question can be exported uncompressed then setup with cue points using the Flash encoder as an alternative (i.e. or even After FX CS3 also) which both provide the same features as Premiere CS4 seemingly. It is just that it would be much easier to be able to drop in simple markers whilst working with Premiere CS3, as this is what we are going to be using primarily, I just wondered if anyone knew how to invoke this in CS3 - its possible you can't, the documentation is vague at best!
However I really appreciate your response and help, thanks -
Calculating duration between cue point?
I'm using Flash Pro CS3. My project is AS2 targeting FP8.
I have an flv component on stage. My .flv has cue points and
I have buttons underneath the component that show the title of each
navigation cuepoint in a dynamic text field. I have another dynamic
text field that shows the cuepoint time for each cuepoint,
positioned next the the title of the cuepoint. That all works well
but hoping to accomplish a bit more and can't find any code help.
The three things I'm trying to do are:
1. Instead of showing current time at a particular cuepoint,
show the duration of the section/chapter, if you will. How can I
calculate duration between two cuepoints and display it in my
dynamic text field? Is there something I should do when
encoding/adding the cuepoints or can I use AS with the cuepoints I
have?
2. Once I get that duration and have it display instead of
the actual cuepoint time, have it countdown backwards when the
playhead is in that "chapter"?
3. Show these times in the mm:ss format?
Thanks for any help or links you think might be helpful...
-ScottFunction Modules related to Date and Time Calculations
CALCULATE_DATE : Calculates the future date based on the input .
DATE_TO_DAY : Returns the Day for the entered date.
DATE_COMPUTE_DAY : Returns weekday for a date
DATE_GET_WEEK : Returns week for a date -
I need help with my event-based cue points with audio
Im having trouble with my video game project for my action script 3 class at school. Here is what i did, i made a game called Tailgate toss up. I filmed my character and rendered it in Adobe Premiere. I than brought my .mov file into After Effects and I put event-based cue points-
my first cue point at 0:00:03:13 called "loop"
my second cue point at 00:00:03:27 called "draw"
my third cue point at 00:00:05:24 called "bang"
my fourth cue point at 00:00:13:29 called "dead"
my fifth cue point at 00:00:14:29 called "You Lose"
my last cue point at 00:00:19:14 called "End"
Here is my action script 3 code
///first frame:
start_btn.addEventListener(MouseEvent.CLICK, startGame);
function startGame(event:MouseEvent){
gotoAndStop(2);
SoundMixer.stopAll()
stop();
///second frame:
stop();
var loopTime
var hitHim:Boolean = false;
var vConnection:NetConnection = new NetConnection();
vConnection.connect(null);
var vStream:NetStream = new NetStream(vConnection);
var client:Object = new Object();
client.onCuePoint = onCuePoint;
vStream.client = client;
var myVideo:Video = new Video(418, 480);
myVideo.y = 0; ///this adjusts where the video is, right now it is the size of the canvas which is 418,480
addChild(myVideo);
myVideo.attachNetStream(vStream);
vStream.play("michelle.flv");
var throw_bottle:Sound
throw_bottle = new Sound(new URLRequest("audio/throw_bottle.mp3")); //change to button noise, will add sound into ae file
target_mc.addEventListener(MouseEvent.CLICK, shoot);
target_mc.buttonMode = true;
target_mc.visible = false;
draw_mc.visible = false;
function onCuePoint(cuePoint:Object):void {
if(cuePoint.name == "loop"){
loopTime = cuePoint.time;
if(cuePoint.name == "draw"){
var randomLoop:Number = Math.random()*10;
if(randomLoop > 2){
vStream.seek(loopTime);
}else{
setChildIndex(target_mc, numChildren - 1);
setChildIndex(draw_mc, numChildren - 1);
target_mc.visible = true;
draw_mc.visible = true;
if(cuePoint.time == "5:24"){
draw_mc.visible = false;
target_mc.visible = false;
if(!hitHim){
vStream.seek(15);
if(cuePoint.name == "dead"){
vStream.close();
myVideo.clear();
gotoAndStop(3);
if(cuePoint.name == "end"){
gotoAndStop(3);
function shoot(event:MouseEvent){
throw_bottle.play();
hitHim = true;
///my third and last frame
playAgain_btn.addEventListener(MouseEvent.CLICK, playAgain);
function playAgain(event:MouseEvent){
gotoAndStop(2);
SoundMixer.stopAll()
stop();
When I have no audio it works perfectly, no problems. When I bring audio in i re-render it as a .mov file and bring it back into After Effects and add the cue points to it. Than i re-render it out again as a flv file. When i bring it into my flash project it will work when the looping variable does just one loop and my target will appear so you can click on it or not. But when the looping variable makes it loop 2 to 10 times it skips over the catching (the part of the clip if you clip the button) and goes directly to the dropping of the can, not giving you the option of clicking the button. So basically it skips the "draw" or second cue point of my game and goes to "You Lose" cue point.
Any suggestions?Hi,
The latest audio driver for your machine is on the following link.
http://ftp.hp.com/pub/softpaq/sp59501-60000/sp59649.exe
Regards,
DP-K
****Click the White thumb to say thanks****
****Please mark Accept As Solution if it solves your problem****
****I don't work for HP****
Microsoft MVP - Windows Experience -
I have set a cue point in my FLV at 58 seconds. Can someone
tell / show me
how I can add a pause to the video when it reaches that first
cue point. I
have it set (intially) called break and it is set to 'Event'.
Thanks. I am an eager noobie to Flash video and actionscript.NetStream events have nothing to do with cue points.
onCuePoint method belongs to NetStream client. So, you will need
something like this:
client.onCuePoint = pointListener;
function pointListener (cuePoint:Object):void {
trace(cuePoint.name + " " + cuePoint.time);
In a nutshell NetStream events are fired when changes occur
in video delivery (buffer, start, pause, etc.) - not video content.
More information:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetStream.html
As for your code, your syntax is not correct.
You wrote: vid.addEventListener(NetStatusEvent.NET_STATUS,
"myFirstCuePoint");
If you listener function is myFirstCuePoint you need to
write:
vid.addEventListener(NetStatusEvent.NET_STATUS,
myFirstCuePoint); - no quotes.
Also, I don't use FLVPlayback - it has it's own methods and
events. What I wrote pertains to the cases when NetSream and
NetConnection are used stand alone.
Maybe you are looking for
-
Hello Experts, Can we have a standard SAP report which will give me the list of pending GRs (IR is done first). i need this report at plant or P.org level. Thanks, Input
-
Delete multiple duplicates at once without selecting one at a time...
I know that you can view duplicates and then select songs one at a time to delete. Because show duplicates shows both the duplicate file and the original you need to select one duplicate and skip one for the original file for each duplicate song. The
-
Iphone is disabled connect to itunes iphone 5
iphone is disabled connect to itunes iphone 5
-
My Ipod is disabled and says connect to itunes
My sons ipod touch is disabled and says to connect to itunes. Tried to go to devices, but says it is not located in computer.
-
T520 hotkeys stopped working on Win 8
I upated some apps like: PM, Bluetooth drivers and some more which had updates in 2013 (since I last upated in 2012) and hotkeys doesn't work. For example Fn+F5 just turns off wifi through windows 8. Fn+F8 doesn't work either. Please help.