Doing seek before movie has started?
hallo,
i hope able me problem, because did spend lot time trying solve this.
the point start video @ specific time, not creating subclip. option allready know, have use whole movie work with.
at moment i'm using loop checking if seektrait exists , performs seek. in cases function not find seektrait @ 30th loop. video jumps point 0, not solution looking for.
--------
<code>
public function tryseektime( value:number ):void {
if ( tryseektimer ) {
tryseektimer.stop();
tryseektimer.removeeventlistener( timerevent.timer, onseektimer );
}
tryseektimevalue = value;
tryseektimer = new timer( try_seek_timer_delay );
tryseektimer.addeventlistener( timerevent.timer, onseektimer );
tryseekloopindex = 0;
tryseektimer.start();
}
private function onseektimer( event:timerevent ):void {
if ( !seeking && ( lastseekvalue != tryseektimevalue ) ) { // seek when not seeking same value @ moment
seektime( tryseektimevalue );
}
tryseekloopindex++;
if ( tryseekloopindex > try_seek_max_loop ) { // when maximum reached, stop seeking
ontimerseekcomplete( null );
}
}
/**
* seek video position passing time value in seconds.
*
* @param value time seconds
*/
public function seektime( value:number ):void {
seeking = true;
var mediaseek : seektrait = mediaplayer.media.gettrait( mediatraittype.seek ) seektrait;
if ( mediaseek) { // seek object existing
if ( mediaseek.canseekto( value ) ) {
mediaseek.addeventlistener( seekevent.seeking_change, onmediaseektimechange );
mediaseek.seek( value );
lastseekvalue = value;
}
} else {
seeking = false;
dispatchevent( new event( "onseekfailed" ) );
}
}
</code>
especially when using rtmp there should easy solution offer functionality. think, i'm not first 1 looking solution starting @ time x.
excluding point i'm satisfied osmf, thank work. guess solution somewhere in videoelement or dynamicstreaming object.
thank much,
chris
instead of periodically poll seek trait, may subscribe canseekchange event of org.osmf.events.mediaplayercapabilitychangeevent class. when value true, know seek trait available,
-wei zhang
senior computer sciientist
adobe systems, inc
More discussions in Developers
adobe
Comments
Post a Comment