Frame 1
function playFLV() {
return((g_flvVariable != undefined) || (g_flvURL != undefined));
}
function arrange() {
if (!isFullScreen()) {
background._x = 0;
background._y = 0;
background._width = 0;
background._height = 0;
background._visible = false;
border._visible = true;
control.showControl();
g_videoObj._x = g_marginLeft;
g_videoObj._y = g_marginTop;
g_videoObj._width = Stage.width - (g_marginLeft + g_marginRight);
g_videoObj._height = Stage.height - (g_marginTop + g_marginBottom);
} else {
background._x = 0;
background._y = 0;
background._width = Stage.width;
background._height = Stage.height;
background._visible = true;
border._visible = false;
control.hideControl();
if (!((g_videoWidth != 0) && (g_videoHeight != 0))) {
g_videoObj._x = (Stage.width - g_videoObj._width) / 2;
g_videoObj._y = (Stage.height - g_videoObj._height) / 2;
} else {
var _loc4 = 0;
var _loc3 = 0;
var _loc2 = Stage.width;
var _loc1 = Stage.height;
if ((g_videoWidth / g_videoHeight) <= (Stage.width / Stage.height)) {
_loc2 = int(Stage.height * (g_videoWidth / g_videoHeight));
_loc4 = (Stage.width - _loc2) / 2;
} else {
_loc1 = int(Stage.width / (g_videoWidth / g_videoHeight));
_loc3 = (Stage.height - _loc1) / 2;
}
g_videoObj._x = _loc4;
g_videoObj._y = _loc3;
g_videoObj._width = _loc2;
g_videoObj._height = _loc1;
}
}
border.arrange();
control.arrange();
}
function initPlayer() {
if (g_initilized == undefined) {
_lockroot = false;
g_version = getVersion();
_lockroot = true;
g_flvLoaded = false;
g_isPlaying = false;
g_isEnd = false;
g_soundObj = new Sound();
g_soundMute = false;
if (g_flvVariable != undefined) {
g_flvURL = eval (g_flvVariable);
}
if (!playFLV()) {
g_currentFrame = _currentframe;
_root.onEnterFrame = function () {
if (!control.vt.isDragging) {
g_isPlaying = g_currentFrame != _currentframe;
g_currentFrame = _currentframe;
}
var _loc2 = g_isEnd;
g_isEnd = _currentframe == _totalframes;
if ((!_loc2) && (g_isEnd)) {
if (g_endURL != undefined) {
getURL (g_endURL, ((_root.g_endURLTarget == undefined) ? "" : (_root.g_endURLTarget)));
}
if (g_endSWF != undefined) {
_root.loadMovie(g_endSWF);
}
}
if (g_isEnd && (!control.vt.isDragging)) {
if (g_isPlaying) {
if (!(g_autoRewind || (g_repeat))) {
g_isPlaying = false;
stop();
} else {
changeCurrentFrame(1);
if (!g_repeat) {
g_isPlaying = false;
stop();
} else {
play();
}
}
}
}
updateControls();
};
if (!g_autoPlay) {
g_autoPlay = true;
stop();
}
} else {
arrange();
if (g_flvURL != undefined) {
control.vt.time.text = "Streaming...";
g_currentTime = 0;
g_netConnection = new NetConnection();
g_netConnection.connect(null);
g_netStream = new NetStream(g_netConnection);
g_videoObj.attachVideo(g_netStream);
g_videoObj.smoothing = true;
g_netStream.setBufferTime(g_bufferTime);
g_netStream.play(g_flvURL);
g_netStream.onStatus = function (infoObj) {
switch (infoObj.code) {
case "NetStream.Play.Start" :
g_flvLoaded = true;
if (!g_autoPlay) {
g_netStream.pause(true);
g_netStream.seek(0);
g_isPlaying = false;
} else {
g_isPlaying = true;
}
return;
case "NetStream.Buffer.Full" :
if ((g_videoWidth == 0) || (g_videoHeight == 0)) {
g_videoWidth = g_videoObj.width;
g_videoHeight = g_videoObj.height;
arrange();
}
return;
case "NetStream.Play.Stop" :
if (g_totalTime != undefined) {
if ((g_totalTime - g_netStream.time) < 0.5) {
g_endTime = g_netStream.time;
}
}
return;
case "NetStream.Seek.Notify" :
return;
case "NetStream.Seek.InvalidTime" :
g_netStream.seek(infoObj.details);
return;
case "NetStream.Play.StreamNotFound" :
control.vt.time.text = "Stream not found.";
var _loc1 = new TextFormat();
_loc1.color = 16711680 /* 0xFF0000 */;
control.vt.time.setTextFormat(_loc1);
}
};
g_netStream.onMetaData = function (infoObj) {
g_totalTime = Math.floor(infoObj.duration);
};
} else {
control.vt.time.text = ("\"" + g_flvVariable) + "\" not defined.";
var fmt = new TextFormat();
fmt.color = 16711680 /* 0xFF0000 */;
control.vt.time.setTextFormat(fmt);
}
_root.onEnterFrame = function () {
if (g_endTime != undefined) {
var _loc3 = g_isEnd;
g_isEnd = g_netStream.time >= g_endTime;
if ((!_loc3) && (g_isEnd)) {
if (g_endURL != undefined) {
getURL (g_endURL, ((_root.g_endURLTarget == undefined) ? "" : (_root.g_endURLTarget)));
}
if (g_endSWF != undefined) {
_root.loadMovie(g_endSWF);
}
}
}
if (g_isEnd) {
var _loc2 = g_isPlaying;
if (g_isPlaying) {
g_isPlaying = false;
g_netStream.pause(true);
}
if (!control.vt.isDragging) {
if (_loc2) {
if (g_autoRewind || (g_repeat)) {
changeCurrentFrame(0);
if (g_repeat) {
g_isPlaying = true;
g_netStream.pause(false);
}
}
}
}
}
updateControls();
};
var stageListener = new Object();
stageListener.onResize = arrange;
Stage.addListener(stageListener);
}
g_initilized = true;
}
}
function changeCurrentFrame(pos) {
if (!playFLV()) {
if (!((g_isPlaying && (!control.vt.isDragging)) && (pos < _totalframes))) {
g_currentFrame = pos;
gotoAndStop(pos +0);
} else {
g_currentFrame = 0;
gotoAndPlay(pos);
}
} else {
g_netStream.seek(pos);
}
}
function isFullScreen() {
return(Stage.displayState == "fullScreen");
}
function updateControls() {
control.b_play._visible = !g_isPlaying;
control.b_pause._visible = g_isPlaying;
control.vt.syncIndicatorWithVideo();
}
var g_fps = 25;
var g_autoPlay = true;
var g_autoRewind = false;
var g_repeat = true;
var g_skinColor = 8421504;
var g_skinColorSaturation = 30;
var g_bufferTime = 2;
var g_soundVolume = 100;
var g_marginLeft = 0;
var g_marginTop = 0;
var g_marginRight = 0;
var g_marginBottom = 0;
var g_initilized;
var g_version;
var g_flvLoaded;
var g_netConnection;
var g_netStream;
var g_videoObj;
var g_videoWidth = 0;
var g_videoHeight = 0;
var g_totalTime;
var g_endTime;
var g_soundObj;
var g_soundMute;
var g_currentFrame;
var g_isPlaying;
var g_isEnd;
Stage.align = "TL";
Stage.scaleMode = "noScale";
initPlayer();