NetStream.resume() has no effect
Hi everyone,
I'm developing a videos slideshow in AS3. Here my Video.as class that handles connection&stream of each player :
package com.dm.player
{
import flash.display.Sprite;
import flash.media.SoundTransform;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.Event;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
public class Video extends Sprite
{
private var config : Object;
private var connection : NetConnection;
private var stream : NetStream;
private var video : flash.media.Video;
private var addedToStage : Boolean = false;
public function Video(config : Object)
{
this.config = config;
this.addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
}
private function onAddedToStage(event : Event) : void
{
if (this.addedToStage)
{
return;
}
this.addedToStage = true;
this.video = new flash.media.Video();
this.connection = new NetConnection();
this.addChild(this.video);
}
private function onStreamNetStatus(event : NetStatusEvent) : void
{
switch (event.info.code)
{
case 'NetStream.Buffer.Flush':
if (this.paused)
{
this.paused = false;
this.stream.play();
}
break;
case 'NetStream.Buffer.Full':
this.paused = true;
this.stream.pause();
break;
case 'NetStream.Play.Stop':
this.paused = false;
this.connection.close();
this.stream.close();
this.video.attachNetStream(null);
break;
}
}
public function cue(streamURL : String) : void
{
this.connection.connect(null);
this.stream = new NetStream(this.connection);
this.stream.addEventListener(NetStatusEvent.NET_STATUS, this.onStreamNetStatus);
this.stream.client = this;
// mute sound
var newSoundTransform : SoundTransform = this.stream.soundTransform;
newSoundTransform.volume = 0;
this.stream.soundTransform = newSoundTransform;
this.stream.receiveAudio(false);
this.video.attachNetStream(this.stream);
this.video.width = this.config.width;
this.video.height = this.config.height;
this.stream.play(streamURL);
}
public function onMetaData(info : Object) : void {}
}
}
Sometimes this.stream.resume() has no effect on videos. The slideshow stops on a video and nothing happens : no event.info.code from onStreamNetStatus.
Any ideas ?
Thanks for your help.
Yvan