Netstream seek on MP4 file not working on Air

I wanting to play a MP4 video file locally on desktop and start at 30seconds into the video timeline.
When I do nothing happens and the video plays from the beginning instead of 30seconds.
The netstream is attached to a StageVideo object.

I also tried, 30) instead of the above seek command but still it starts playing at 0 seconds.

As said the file is located on my harddisk so there is no network involved here, its a local file.
Is this expected behaviour? Interestingly after the video completes playing If I do, the video seeks to frame at 0 sec.

which platform?
which version of the runtime? is it AIR? Flash?
some sample code?
how do you test?
which type of file do you use to test?


you gonna have to provide more details and context for other people to help

“as is” it could be anything from you not initializing the netstream correctly to your video file being badly encoded

top of my head I would say
for a local file you don’t have any connection to a server
eg. Loading video files

and in the doc of
all mention of seeking imply being connected to a server

usually a streaming server ensure you have keyframes and metadata into the file

without a server, then it depends on how the file was encoded, if encoded poorly maybe an issue with keyframes so it end up not being able to seek

it could be that, it could be a buffer issue, it could be a thousands of things
but because you do not provide details and context it is impossible to know

1 Like

Platform: Windows 7 x64
SDK: Air SDK 29,
Runtime: Adobe Air
Flash Develop => Building for Swf Version 40

I’m following the example given on this site

Instead of Video class I am using StageVideo.

StageVideo is not the same as Video, you have to wait for the API to send an event
see Using the StageVideo APIs

what file do you use to test?

as mentioned before a badly encoded mp4 would cause problems

also, how hard it is to copy/paste the damn code here?

The StageVideo is working for playing / pausing / scrubbing etc. everything works well.
Its only not allowing me to seek ahead in time.
I will post the video shortly.

I tried uploading a mp4 file but the site doesn’t allow me to do that, it says only image / doc types are accepted.

This is the init code

   private function initVideo(evt:StageVideoAvailabilityEvent):void {
		_holder.stage.removeEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, initVideo2);
		// if stage 3D available
		if (evt.availability == StageVideoAvailability.AVAILABLE) {
			// fetch stage videos
			stageVid = _holder.stage.stageVideos[0];
			stageVid.addEventListener(StageVideoEvent.RENDER_STATE, onRenderState);
		// use Video Class here
		}else {
		// create a new net connection, add event listener and connect
		// to null because we don't have a media server
		ncConnection = new NetConnection();
		ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
		// create a new netstream with the net connection, add event
		// listener, set client to this for handling meta data and
		// set the buffer time to the value from the constant
		nsStream = new NetStream(ncConnection);
		nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
		nsStream.client = this;
		nsStream.bufferTime = BUFFER_TIME;
		// attach net stream to video object on the stage

after this I try to call;;

but to no avail.

see Announcement: If you ask for help about code
eg. post your sample project on Github or something

I did some more tests, and it seems that I have to wait for a RENDER_STATE event, and call seek after a event has occured. Seems to be the way to go. I did some preliminary tests on this.

yes as mentioned earlier

StageVideo is not the same as Video, you have to wait for the API to send an event
see Using the StageVideo APIs