Highlighted

loading flv with netstream in AirforIOS

Participant ,
Aug 28, 2017

Copy link to clipboard

Copied

Dear Friends,

Iam creating an elearning app, in that iam loading a flv video its loading fine. working well. If I move to next slide while loading the flv video, the vo is playing behind. If I move to next slide after the flv loaded, there is no issue. Pls tell me the way to track whether the flv is still loading? iam using the following code to load my flv video.

import flash.display.Sprite;

import flash.events.NetStatusEvent;

import flash.events.SecurityErrorEvent;

import flash.media.Video;

import flash.net.NetConnection;

import flash.net.NetStream;

import flash.events.Event;

var videoURL: String = "testvideo.flv"
var connection: NetConnection;
var stream: NetStream;
var video: Video = new Video();
video.width = 640;
video.height = 360;
video.x = 0;
video.y = 0;
NetConnectionExample()


function NetConnectionExample() {
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.connect(null);
}

function netStatusHandler(event: NetStatusEvent): void {
trace("Stream Status :" + event.info.code);
switch (event.info.code) {
  case "NetConnection.Connect.Success":
   connectStream();
   break;
  case "NetStream.Play.Start":
   break;
  case "NetStream.Play.StreamNotFound":
   break;
  default:

   if (this.name != "video_mc") {
    stream.seek(0);
    stream.pause();
    stream.close();
   }
   break;
}
}

function securityErrorHandler(event: SecurityErrorEvent): void {
trace("securityErrorHandler: " + event);
}

function connectStream(): void {
addChild(video);
var stream: NetStream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.client = this;
video.attachNetStream(stream);
stream.play(videoURL);
}

Thanks and Regards,

Syed Abdul Rahim

TOPICS
Development

Views

193

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

loading flv with netstream in AirforIOS

Participant ,
Aug 28, 2017

Copy link to clipboard

Copied

Dear Friends,

Iam creating an elearning app, in that iam loading a flv video its loading fine. working well. If I move to next slide while loading the flv video, the vo is playing behind. If I move to next slide after the flv loaded, there is no issue. Pls tell me the way to track whether the flv is still loading? iam using the following code to load my flv video.

import flash.display.Sprite;

import flash.events.NetStatusEvent;

import flash.events.SecurityErrorEvent;

import flash.media.Video;

import flash.net.NetConnection;

import flash.net.NetStream;

import flash.events.Event;

var videoURL: String = "testvideo.flv"
var connection: NetConnection;
var stream: NetStream;
var video: Video = new Video();
video.width = 640;
video.height = 360;
video.x = 0;
video.y = 0;
NetConnectionExample()


function NetConnectionExample() {
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.connect(null);
}

function netStatusHandler(event: NetStatusEvent): void {
trace("Stream Status :" + event.info.code);
switch (event.info.code) {
  case "NetConnection.Connect.Success":
   connectStream();
   break;
  case "NetStream.Play.Start":
   break;
  case "NetStream.Play.StreamNotFound":
   break;
  default:

   if (this.name != "video_mc") {
    stream.seek(0);
    stream.pause();
    stream.close();
   }
   break;
}
}

function securityErrorHandler(event: SecurityErrorEvent): void {
trace("securityErrorHandler: " + event);
}

function connectStream(): void {
addChild(video);
var stream: NetStream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.client = this;
video.attachNetStream(stream);
stream.play(videoURL);
}

Thanks and Regards,

Syed Abdul Rahim

TOPICS
Development

Views

194

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 28, 2017 0

Have something to add?

Join the conversation