actionscript 3 - FLVPlayback/VideoPlayer: How to access VideoPlayer.load() method that accepts 5 parameters? -


i want use following load() method accepts 5 parameters can load small "excerpt" larger video:

http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/fl/video/videoplayer.html#load()

in particular, starttime , duration parameters seem need, getting errors seem indicate don't have right object/version of something, though adobe docs should work. here steps:

  • start new, blank fla document (as3).
  • drag flvplayback component stage , name vplayer.
  • create new layer , 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 ten-second clip starting one-minute mark, keep getting errors argumenterror: error #1063: argument count mismatch on fl.video::videoplayer/load(). expected 1, got 5.

i've tried casting innerplayer fl.video.videoplayer, doesn't work.

what doing wrong?


edits: though i'm on cs4/as3 , documentation claims apply cs4/as3, class files in "component source" folder don't seem match documentation. tried in cs6, , got "1137: incorrect number of arguments. expected no more 3."

@sunild. - cs4: flvplayback.version=2.1.0.19, , targeting flash player 10 (the recent available)+as3. cs6, flvplayback.version=2.5.0.26, , targeting flash player 11.4.

in cs4 , cs6, errors videoplayer load() requires 1 argument (with 2 optional), , play() has 3 optional arguments. 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 date. manually installing flvplayback 2.5 component didn't work.

anon, think issue of poor documentation / many different products (flash, flex, player, flvplayback component) different versions.

i able .load() call work 5 arguments (and verified did start playing @ specified start time), compiling new flvplayback_116.swc latest flex sdk source code (flex 4.6 playerglobal.swc version 11.6).

see screenshot.

might see if works you. here's you'll need do:

  • remove flvplayback component library - defines conflicting classes updated version.
  • download flvplayback_116.swc library
  • in flash, open file -> actionscript settings dialog, under library path tab, click 'browse swc file' , locate flvplayback_116.swc file downloaded. screenshot above shows dialog , how flvplayback_116.swc file listed after being added.
  • in code (see below):
    • you need set: fl.video.videoplayer.incmanagerclass = fl.video.ncmanager;
    • rather using innerplayer = vplayer.getvideoplayer you'll need use innerplayer = new videoplayer(width,height) , addchild(innerplayer) , innerplayer.play()
    • i had add innervideo.play() call start video playing (which assume gui handle)

here's code (also visible in screenshot):

import fl.video.*;  fl.video.videoplayer.incmanagerclass = fl.video.ncmanager; var innerplayer = new videoplayer(640,480); addchild(innerplayer);  innerplayer.load(       "http://10.0.1.3/test.flv"     , 0 // totaltime     , false // islive     , 5 // starttime     , 5 // duration ); innerplayer.play(); 

also, can see describetype of videoplayer shows proper number of arguments:

<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"/>   <parameter index="4" type="number" optional="true"/>   <parameter index="5" type="number" optional="true"/>   <metadata name="__go_to_definition_help">     <arg key="pos" value="41308"/>   </metadata> </method>  <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"/>   <parameter index="4" type="number" optional="true"/>   <parameter index="5" type="number" optional="true"/>   <metadata name="__go_to_definition_help">     <arg key="pos" value="34410"/>   </metadata> </method> 

update: i've updated library can instantiate flvplayback(w,h) , hence apply skins or whatnot -- treat vplayer in code above (except added width/height constructor args, since size used come component on-stage). instantiate so:

  var vplayer:flvplayback = new flvplayback(640,480);   vplayer.skin = "http://10.0.1.3/skin.swf"; // optional skin   addchild(vplayer);   var innerplayer = vplayer.getvideoplayer(vplayer.activevideoplayerindex);   innerplayer.load(                    "http://10.0.1.3/test.flv"                    , 0 // totaltime                    , false // islive                    , 5 // starttime                    , 5 // duration                    ); 

note - use skin, compiled 1 of fla examples flash cs6... tried using skin found on internet , didn't work - compiled older version. see skinned screenshot , download skin.swf.

good luck, , let me know if need further info!


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -