Pages: [1]
  Print  
Author Topic: Using Cue Points within Gaia without FLV Component  (Read 276 times)
mosk
Gaia Expert
****
Posts: 207


« on: August 18, 2011, 02:26:51 PM »

I have Flash Cue points embedded in several flv files.  I've been using the Event type cue points to trigger events through as3 scripting, and that's working fine.
I also have several Navigation type cue points embedded in a long video.

Currently flv stops at the end of part 1 (when it hits an event cue point that triggers the following line of code:

Code:
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).pause();


I have movie clips/buttons A-G, that I want users to click to play parts A-G of the same flv.  
I do NOT have a flash IDE's flvPlayback component, so not sure if I can use the seekToNavCuePoint at all.

Code:
1061: Call to a possibly undefined method seekToNavCuePoint through a reference with static type com.gaiaframework.api:INetStream

So how do I get the click handler to resume play of the flv at the appropriate part?
 
Code:
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).play("CuePointA");
or
Code:
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).seek("CuePointA");
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).play();
both give me Error: 1067:Implicit coercion of a value of type String to an unrelated type Number

Thanks for any help.
« Last Edit: August 18, 2011, 05:31:46 PM by mosk » Logged
Ramiro
Moderator
Gaia Addict
*****
Posts: 861


interactive pragmatism


« Reply #1 on: August 18, 2011, 05:43:04 PM »

you need to parse the cuepoint metadata, extract the time value of your desired cuepoint and seek + play to that value...
or, you could use the VideoLoader class from greensock (part of LoaderMax), which has quite a few utilities, seekToCuePoint among them.

I had a similar situation a few months ago, and finally droped the video asset and used the VideoLoader Wink
Logged
mosk
Gaia Expert
****
Posts: 207


« Reply #2 on: August 18, 2011, 06:22:59 PM »

Hey Ramiro -

I'd actually found that other post of yours where you talked about using LoaderMax and I'm watching some tutorials on that right now.  Was hoping not to add any more learning curves, since I just want to get my site up and running, but I'm going to have lots of animated flv's that need to communicate to flash movieclips through CuePoints, and if this Loader platform is anywhere near as useful as greensock's tweening, I guess I should try to add it to my skill set.

I'll watch those greensock tutorials and read through the documentation, but is there anything specific to Gaia that I should watch for in terms of maintaining the current functionality of my flvs.  I have them listed as videoassets for their given pages in the site.xml.   And this is some of the code I use to get my videos ready at this point (all videos are controlled from my Nav page)

Code:
public function prepareVideo():void
{
if(videoClickedName == "BTN_KillVideo")

{
trace("(note - if index/nav then get rid of sep ns statemnent - videoAssetOfThisPage = " + videoAssetOfThisPage);
ns = Gaia.api.getPage("index/nav").assets[id] as INetStream;
//trace("ns for KillVideo = " + ns);
}
else
{
ns = Gaia.api.getPage(videoAssetOfThisPage).assets[id] as INetStream;
}
if (ns)
{
ns.attach(myVideo);
Gaia.api.getDepthContainer(Gaia.MIDDLE).addChild(myVideo);
addVideoBtns();
}
else
{
trace("invalid ID");
playVideo("videoAsset1");
}
}
Logged
Ramiro
Moderator
Gaia Addict
*****
Posts: 861


interactive pragmatism


« Reply #3 on: August 18, 2011, 07:00:09 PM »

gaia helps you load the flv files as assets. If you need anything more complex, you need to code it yourself. VideoLoader is dead simple, the only drawback is that you have to load the videos without Gaia's asset system (if you want, keep the assets with preload=false and grab the urls from asset.yourAsset.node.@src). Once loaded, you simply call gotoCuePoint('cuePointName') and that's it. All your other logic remains the same
Logged
mosk
Gaia Expert
****
Posts: 207


« Reply #4 on: August 19, 2011, 07:53:59 AM »

Hey Ramiro.   I probably will implement greensock's VideoLoader, but for now, as a quick fix, I went an manually figured out the time codes for my cuepoints.

So partA of videoAssetMINE starts at 0 seconds, part B at 45.2, partC at 130.8 seconds and so forth.

When my partA, partB, partC buttons are clicked, the Number variable seekVal is set to the corresponding number/time in seconds (0, 45,2, 130.Cool.
Trace statements show that this is registering properly. 
Then, in my play function, if the video's id coresponds to this particular lengthy FLV, I want to seek to the seekVal time so I can play partA, partB, or partC depending on which button was clicked. 

The buttons always trigger the movie to play from the beginning however.
Not sure what I'm doing wrong.  Code is pasted below:


Code:
if(id == "videoAssetMINE")  // note that id corresponds to the FHIntro below
{
trace("id = " + id + " and if that's videoAssetMINE will then seek to seekVal of " + seekVal);
ns.seek(seekVal);
}

ns.play();
trace("E here setting asset video's vol, pan, play and pause and netstream stuff");

When that didn't work, I tried moving the seek higher up in the playVideo function as follows:
Code:
private function playVideo(id:String):void
{
//PREVIOUS if statements here then relevant code:
else if (videoClickedName == "FHIntro")
{
trace("here setting asset video's vol, pan, play and pause and netstream stuff - videoAssetOfThisPage = " + videoAssetOfThisPage + " and myVideoId = " + myVideoId);
trace("id = " + id + " and if that's videoAssetFHTH1 will then seek to seekVal of " + seekVal);
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).volume = 1;
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).pan = 0;
[b]INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).seek(seekVal);[/b]
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).play();
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId]).pause();
trace("B here setting asset video's vol, pan, play and pause and netstream stuff");
//trace("using " + myVideoId);
INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId].addEventListener(NetStatusEvent.NET_STATUS, onNetStreamStatus, false, 0, true));

INetStream(Gaia.api.getPage(videoAssetOfThisPage).assets[myVideoId].addEventListener(NetStreamAssetEvent.CUEPOINT, onMyCuePoint, false, 0, true));
trace("C here setting asset video's vol, pan, play and pause and netstream stuff");
}

else
{
//code for other videos
}

trace("D here setting asset video's vol, pan, play and pause and netstream stuff");
if(!id) id="videoAsset1";
currentVideoID = id;
trace("currentVideoID = " + currentVideoID);
//var ns:INetStream = assets[id] as INetStream;
prepareVideo();
trace("back from prepareVideo - will now play video with ns.play()");



ns.play();
trace("E here setting asset video's vol, pan, play and pause and netstream stuff");

}





This is the code I have in my prepare video function.  I don't know if this is somehow telling flash to play from the beginning instead of the seekVal I implemented above.  Do I need to place my seek function down here after this ns is created?  Or does seek simply not work the way I'm trying to use it.
Code:
public function prepareVideo():void
{

ns = Gaia.api.getPage(videoAssetOfThisPage).assets[id] as INetStream;

if (ns)
{
ns.attach(myVideo);
Gaia.api.getDepthContainer(Gaia.MIDDLE).addChild(myVideo);
addVideoBtns();
}

}

Thanks for any help.
(also tried
Code:
ns.play(seekVal)
instead of just ns.play() but video still starting from the beginning)

« Last Edit: August 19, 2011, 08:38:57 AM by mosk » Logged
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v1.0 beta 4 © Bloc