I want to use the following load()
method that accepts five parameters so that I can load a small "excerpt" from a larger video:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/VideoPlayer.html#load()
In particular, the startTime
and duration
parameters seem to be what I need, but I am getting errors that seem to indicate that I don't have the right object/version of something, even though the Adobe docs say that it should work. Here are my steps:
- Start a new, blank FLA document (AS3).
- Drag an FLVPlayback component to the stage and name it vPlayer.
Create a new layer and add Actionscript in frame 1:
import fl.video.*; var innerPlayer = vPlayer.getVideoPlayer(vPlayer.activeVideoPlayerIndex); trace(innerPlayer); // "[object VideoPlayer]" appears in Output window innerPlayer.load( "RTMP://..." , 0 // totalTime , false // isLive , 60 // startTime , 10 // duration );
This should give me a ten-second clip starting from the one-minute mark, but I keep getting errors like ArgumentError: Error #1063: Argument count mismatch on fl.video::VideoPlayer/load(). Expected 1, got 5.
I've also tried casting innerPlayer to fl.video.VideoPlayer, but that doesn't work.
What am I doing wrong?
EDITS: Even though I'm on CS4/AS3 and the documentation claims to apply to CS4/AS3, the class files in my "Component Source" folder don't seem to match the documentation. I also tried this in CS6, and I got "1137: Incorrect number of arguments. Expected no more than 3."
@SunilD. - For CS4: FLVPlayback.VERSION
=2.1.0.19, and I am targeting Flash Player 10 (the most recent available)+AS3. For CS6, FLVPlayback.VERSION
=2.5.0.26, and I am targeting Flash Player 11.4.
In CS4 and CS6, the errors say that VideoPlayer load()
only requires one argument (with two optional), and play()
has three optional arguments. The output of describeType(innerPlayer)
confirms:
<type name="fl.video::VideoPlayer" base="flash.media::Video" isDynamic="false" isFinal="false" isStatic="false">
...
<method name="play" declaredBy="fl.video::VideoPlayer" returnType="void">
<parameter index="1" type="String" optional="true"/>
<parameter index="2" type="Number" optional="true"/>
<parameter index="3" type="Boolean" optional="true"/>
</method>
...
<method name="load" declaredBy="fl.video::VideoPlayer" returnType="void">
<parameter index="1" type="String" optional="false"/>
<parameter index="2" type="Number" optional="true"/>
<parameter index="3" type="Boolean" optional="true"/>
</method>
...
</type>
Other notes: Flash CS6 is up to date. Manually installing the FLVPlayback 2.5 component didn't work.
describeType(innerPlayer)
... (You can see what parameters thatload()
method actually has, or find other clues to confirm what this object actually is). You might also double check your publish settings and, make sure you're publishing a SWF that is targeting as recent a version of Flash Player as possible. – Sunil D.VERSION
constant. The version # in the docs is 2.1.023. What doestrace(FLVPlayback.VERSION)
output in your environment? How many arguments does yourVideoPlayer.play()
method accept? That should have the same args as theload()
method... Finally, does it make any difference if you get the player with thevisibleVideoPlayerIndex
instead ofactiveVideoPlayerIndex
? Or how about if you setactivePlayerIndex=1
(default is 0) and try to use that? – Sunil D.