05-21-2009 08:04 PM
Here's a snippet of relevant code:
private function cueVideo():void
{
_videoPlayerModule.cueVideo(_videoID);
_videoPlayerModule.addEventListener(MediaEvent.BEG
}
private function registerCuePoints(event:MediaEvent):void
{
var overlayPoints:Array = new Array (1000, 2000, 3000, 4000);
_cuePointsModule.addCuePoints(_videoID, overlayPoints);
_cuePointsModule.addEventListener(CuePointEvent.CU
var cueArrayTest:Array = _cuePointsModule.getCuePoints(_videoID);
}
private function onCuePoint(event:CuePointEvent):void
{
trace("Cue!");
}
I'm getting the my test array back as Video DTOs. I'm including all events just in case:
import com.brightcove.api.events.*;
I'm not getting any code editor, compile or runtime errors. I just never get my trace...
Solved! Go to Solution.
05-22-2009 02:01 PM
Cicerone,
You should try specifying your times in Seconds, instead of milliseconds. I'm not sure if our docs are clear on this point but in my examples I've had better luck with seconds.
05-22-2009 02:24 PM
The documentation (API reference) does say milliseconds. But I did try:
var overlayPoints:Array = new Array (1, 2, 3, 4);
And was not able to get a trace. Do they need to be formatted in a certain way and/or strongly typed?
Also, the cue points module itself gives me this constant in code hinting:
CuePointEvent.CUE_POINT (while CuePointEvent itself has CuePointEvent.CUE)
I've tried using either one or even just the string "cuePoint" (with a generic event:Event handler)...
05-22-2009 02:29 PM - edited 05-22-2009 02:29 PM
I've attached an example that I have that is working even though it's not using the PlayerAPI SWC so it might be a little different.
If I had to guess I'd think it was the section where you are creating the Cue points that is the problem. Here is how I'm doing it:
var newCuePoint:Object = new Object();
newCuePoint.assetId = null;
newCuePoint.forceStop = false;
newCuePoint.metadata = null;
newCuePoint.name = "Programmatically Added";
newCuePoint.time = 1;
newCuePoint.version = 0;
newCuePoint.videoId = 1375772128;
newCuePoint.type = 0; // 0 Ad, 1 Code, 2 Chapter, 3 Ad Impressioncue = player.getModule("cuePoints");
cue.addCuePoints(1375772128, [newCuePoint]);
// videoId, array of cue points
05-22-2009 03:03 PM
Works great in Flash, but not in Flex. I'm using the Flex component. I did try just using the plain SWC wrapper as well.
I am getting an array back via:
var cueArrayTest:Array = _cuePointsModule.getCuePoints(_videoID);
So the cue points are sitting there, but just not firing for some reason from the CuePointsModule. Any chance there's something missing in the SWC?
05-24-2009 11:39 PM
There is currently a bug with the player (not the SWC, and not Flex specific, which is why this initially confused me) where adding a cue point to a video that is already playing *that doesn't currently have any other cue points previously set* will not work. You can add a cue point to a video that is not yet playing (such as if it is in a playlist), but not to the current video. This is fixed in our next release.
The simplest workaround right now is to enable adds for the video and the player, but don't target ads to the player (if you have control over that). If you have ads enabled, a preroll and postroll cue point is automatically added, which then enables you to programmatically add other cue points.
I was able to get cue points firing in a new Flex project using the current SWC I just downloaded tonight. The following code is all I have in my project, along with the BrightcovePlayer snippet and a reference to the SWC. With ads enabled, the 10 second cue point fires. With ads turned off, the cue point does not fire.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:bc="com.brightcove.api.*" layout="vertical" width="600" height="500" > <mx:Script> <![CDATA[ import com.brightcove.api.APIModules; import com.brightcove.api.modules.CuePointsModule; import com.brightcove.api.events.CuePointEvent; import com.brightcove.api.events.MediaEvent; import com.brightcove.api.modules.VideoPlayerModule; private var _videoPlayer:VideoPlayerModule; private function onCueVideo(event:MouseEvent):void { _videoPlayer = _player.getModule(APIModules.VIDEO_PLAYER) as VideoPlayerModule; _videoPlayer.addEventListener(MediaEvent.BEGIN, onMediaBegin); _videoPlayer.cueVideo(123456789); } private function onMediaBegin(event:MediaEvent):void { _videoPlayer.removeEventListener(MediaEvent.BEGIN, onMediaBegin); var cuePointModule:CuePointsModule = _player.getModule(APIModules.CUE_POINTS) as CuePointsModule; cuePointModule.addCuePoints(_videoPlayer.getCurren
tVideo().id, [10]); cuePointModule.addEventListener(CuePointEvent.CUE, onCuePoint); } private function onCuePoint(event:CuePointEvent):void { trace(event.cuePoint.time); } ]]> </mx:Script> <bc:BrightcoveFlexComponent id="_player" playerClass="BrightcovePlayer" width="486" height="412"/> <mx:Button click="onCueVideo(event)" label="click me" /> </mx:Application>
05-26-2009 12:17 PM
Brightcove Inc., a leading global provider of cloud content services, provides a family of products used to publish and distribute the world's professional digital media. The company's products include Brightcove Video Cloud, the market-leading online video platform, and Brightcove App Cloud, the pioneering content app platform. Together, more than 4,200 customers in 50 countries rely on Brightcove's cloud content services to build and operate exceptional media experiences across PCs, smartphones, tablets and connected TVs.
Brightcove Inc.
© 2012 Brightcove Inc.
