mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
46 lines
1.3 KiB
ActionScript
46 lines
1.3 KiB
ActionScript
package org.osmf.elements.audioClasses
|
|
{
|
|
import flash.events.Event;
|
|
import org.osmf.traits.TimeTrait;
|
|
|
|
public class AudioTimeTrait extends TimeTrait
|
|
{
|
|
|
|
private var soundAdapter:SoundAdapter;
|
|
|
|
public function AudioTimeTrait(param1:SoundAdapter)
|
|
{
|
|
super();
|
|
this.soundAdapter = param1;
|
|
param1.addEventListener("progress",onDownloadProgress,false,0,true);
|
|
param1.addEventListener("downloadComplete",onDownloadComplete,false,0,true);
|
|
param1.addEventListener("complete",onPlaybackComplete,false,0,true);
|
|
}
|
|
|
|
override public function get currentTime() : Number
|
|
{
|
|
return soundAdapter.currentTime;
|
|
}
|
|
|
|
private function onDownloadProgress(param1:Event) : void
|
|
{
|
|
if(!isNaN(soundAdapter.estimatedDuration) && soundAdapter.estimatedDuration > 0)
|
|
{
|
|
soundAdapter.removeEventListener("progress",onDownloadProgress);
|
|
setDuration(soundAdapter.estimatedDuration);
|
|
}
|
|
}
|
|
|
|
private function onDownloadComplete(param1:Event) : void
|
|
{
|
|
setDuration(soundAdapter.estimatedDuration);
|
|
}
|
|
|
|
private function onPlaybackComplete(param1:Event) : void
|
|
{
|
|
signalComplete();
|
|
}
|
|
}
|
|
}
|
|
|