Copy link to clipboard
Copied
Hi
I have built a simple AIR video player on Windows. When I try to seek to any one of the last 11 frames, the player simply takes me to the last frame, i.e the playback time is correct but the frame shown is wrong. This hapens on Windows but on a MAC, no such issue. I am assuming this is a windows specific bug. Any suggestions on what's wrong?
Copy link to clipboard
Copied
Hi,
Is it possible to get a sample video and source code to duplicate this issue internally?
Moved thread to the Problems & Bugs forum.
Thanks,
Chris
Copy link to clipboard
Copied
My Encoded video.. Video: http://dl.dropbox.com/u/3356282/frameSeek.avi
Source Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
width="700" height="500"
applicationComplete="complete()">
<mx:Script>
<![CDATA[
[Bindable] private var filename:String = '';
private var nc:NetConnection;
private var ns:NetStream;
private var vid:Video;
private var t:Timer;
private function complete():void {
nc = new NetConnection();
nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandler);
nc.addEventListener(NetStatusEvent.NET_STATUS, connStatusHandler);
nc.connect(null);
ns = new NetStream(nc);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandler);
ns.addEventListener(NetStatusEvent.NET_STATUS, streamStatusHandler);
ns.client = { onMetaData:streamMetadataHandler };
t = new Timer(300);
t.addEventListener(TimerEvent.TIMER, streamProgressHandler);
vid = new Video();
uic.addChild(vid);
}
private function openVideo():void {
if (ns) {
ns.pause();
playPause.label = 'PLAY';
}
var docs:File = File.documentsDirectory;
docs.addEventListener(Event.SELECT, openFileHandler);
docs.browseForOpen('Select a Video', [new FileFilter("Video", "*.flv")]);
}
private function openFileHandler(e:Event):void {
var f:File = e.target as File;
filename = f.name;
ns.play('file://' + f.nativePath);
playPause.label = 'PAUSE';
vid.attachNetStream(ns);
t.start();
}
private function errorHandler(e:AsyncErrorEvent):void {
trace('ERROR: ' + e.text);
}
private function connStatusHandler(e:NetStatusEvent):void {
trace('CONN_STATUS: ' + e.info.code);
}
private function streamStatusHandler(e:NetStatusEvent):void {
trace('STREAM_STATUS: ' + e.info.code);
}
private function streamMetadataHandler(info:Object):void {
for (var key:String in info) {
trace("STREAM_METADATA: " + key + "=" + info[key]);
}
uic.width = info.width;
uic.height = info.height;
vid.width = info.width;
vid.height = info.height;
vid.x = 0;
vid.y = 0;
len.text = parseFloat(info.duration).toFixed(1);
}
private function streamProgressHandler(e:TimerEvent):void {
timer.text = ns.time.toFixed(1);
}
private function stopClick():void {
ns.pause();
ns.seek(0);
playPause.label = 'PLAY';
}
private function toggleClick():void {
ns.togglePause();
playPause.label = (playPause.label == 'PAUSE' ? 'PLAY' : 'PAUSE');
}
private function nextFrame():void
{
var thisTime:Number = ns.time;
ns.seek(thisTime+0.02);
}
private function prevFrame():void
{
var thisTime:Number = ns.time;
ns.seek(thisTime-.05);
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Button label="Open Video" click="openVideo()" />
<mx:Label text="{filename}" fontSize="14" fontWeight="bold" />
<mx:Label id="timer" fontSize="14" fontWeight="bold" />
<mx:Label id="len" fontSize="14" fontWeight="bold" />
</mx:ApplicationControlBar>
<mx:Canvas width="100%" height="100%" backgroundColor="#000000" backgroundAlpha="0.1">
<mx:UIComponent id="uic" width="100" height="100" />
</mx:Canvas>
<mx:HBox width="439.4853" height="21.029411">
<mx:Button label="Previous Frame" click="prevFrame()"/>
<mx:Button id="playPause" label="PAUSE" width="100" click="toggleClick()" />
<mx:Button label="STOP" width="100" click="stopClick()" />
<mx:Button label="Next Frame" click="nextFrame()" />
</mx:HBox>
</mx:WindowedApplication>
Copy link to clipboard
Copied
Thanks for providing the video and source sample. I've forwarded this along to one of our video experts and will let you know what they say. I suspect getting frame accurate playback will be problematic using seek(), but I'm not sure why it would differ between platforms. Have you investigated using NetStream.step()?
Chris
Copy link to clipboard
Copied
Thanks for reporting it. Also the erroneous behaviour is different on different configuration machines.
I am not using a streaming mechanism for the videos but instead picking it up from the local machine. I suppose step() is only available when i use the smart seek functionality of FMS. Any way that I can do it when i'm playing videos from my local machine?
Copy link to clipboard
Copied
I talked with a developer about this and he agrees that seek() is probably not the correct method to use. Unfortunately we're both at a loss at what the correct way would be given the Flash Media Server requirement for step().
I'm still concerned about the inconsistency between the two platforms so I've added a bug (#2717689) into our internal database to try and get this resolved.
Thanks,
Chris