mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 09:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,834 @@
|
||||
package movie
|
||||
{
|
||||
import Enums.StreamDef;
|
||||
import collection.StreamDefCollection;
|
||||
import com.sbi.client.KeepAlive;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.printing.PrintJob;
|
||||
import gui.DarkenManager;
|
||||
import gui.FeedbackManager;
|
||||
import gui.LoadingSpiral;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class MovieManager
|
||||
{
|
||||
|
||||
public static const NORMAL_SKIN:int = 1;
|
||||
|
||||
public static const BRADY_BARR_SKIN:int = 2;
|
||||
|
||||
public static const TIERNEY_THYS_SKIN:int = 3;
|
||||
|
||||
public static const CAMI_SKIN:int = 4;
|
||||
|
||||
public static const GABBY_SKIN:int = 5;
|
||||
|
||||
public static const BIGGER_FRAME:int = 6;
|
||||
|
||||
public static const VID_PLAYER_MEDIA_ID:int = 39;
|
||||
|
||||
public static const VID_SELECTOR_MEDIA_ID:int = 202;
|
||||
|
||||
private const MOVIES_PER_SCREEN:int = 4;
|
||||
|
||||
private var _popupLayer:DisplayLayer;
|
||||
|
||||
private var _movieSelector:MovieClip;
|
||||
|
||||
private var _movieSelectorPopup:MovieClip;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _pageNumber:int;
|
||||
|
||||
private var _mediaItems:Array;
|
||||
|
||||
private var _previewImages:Array;
|
||||
|
||||
private var _videoPlayer:VideoPlayerOSMF;
|
||||
|
||||
private var _spirals:Array;
|
||||
|
||||
private var _movieMediaHelper:MediaHelper;
|
||||
|
||||
private var _printMediaHelper:MediaHelper;
|
||||
|
||||
private var _videoPlayerId:int;
|
||||
|
||||
private var _theaterScreen:Object;
|
||||
|
||||
private var _isFromTheater:Boolean;
|
||||
|
||||
private var _isAsking:Boolean;
|
||||
|
||||
private var _titleTxt:String;
|
||||
|
||||
private var _chooseRandom:Boolean;
|
||||
|
||||
private var _printMediaHolder:Array;
|
||||
|
||||
private var _numPrintItemsToLoad:int;
|
||||
|
||||
private var _numPrintItemsLoaded:int;
|
||||
|
||||
private var _loadedImages:Array;
|
||||
|
||||
private var _randomPlayerSkinId:int;
|
||||
|
||||
private var _shouldRepeat:Boolean;
|
||||
|
||||
private var _defaultWidth:int = 512;
|
||||
|
||||
private var _defaultHeight:int = 288;
|
||||
|
||||
private var _skinFrameId:int = 1;
|
||||
|
||||
private var _videoFrameId:int = 1;
|
||||
|
||||
private var _streamDefs:StreamDefCollection;
|
||||
|
||||
private var _closeBtn:MovieClip;
|
||||
|
||||
private var _leftArrow:MovieClip;
|
||||
|
||||
private var _rightArrow:MovieClip;
|
||||
|
||||
private var _mw0:MovieClip;
|
||||
|
||||
private var _mw1:MovieClip;
|
||||
|
||||
private var _mw2:MovieClip;
|
||||
|
||||
private var _mw3:MovieClip;
|
||||
|
||||
private var _playMovBtn0:MovieClip;
|
||||
|
||||
private var _playMovBtn1:MovieClip;
|
||||
|
||||
private var _playMovBtn2:MovieClip;
|
||||
|
||||
private var _playMovBtn3:MovieClip;
|
||||
|
||||
public function MovieManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:DisplayLayer, param2:Object, param3:StreamDefCollection, param4:int = 202, param5:int = 39, param6:Function = null) : void
|
||||
{
|
||||
_popupLayer = param1;
|
||||
if(param4 > 0)
|
||||
{
|
||||
_movieMediaHelper = new MediaHelper();
|
||||
_movieMediaHelper.init(param4,movieHelperCallback);
|
||||
}
|
||||
_closeCallback = param6;
|
||||
if(param2)
|
||||
{
|
||||
if(param2 is MovieClip)
|
||||
{
|
||||
_theaterScreen = param2;
|
||||
}
|
||||
else if(param2.hasOwnProperty("loader"))
|
||||
{
|
||||
_theaterScreen = param2.loader.content;
|
||||
}
|
||||
}
|
||||
_videoPlayer = new VideoPlayerOSMF();
|
||||
if(_theaterScreen)
|
||||
{
|
||||
MovieClip(_theaterScreen).addChild(_videoPlayer);
|
||||
_isFromTheater = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.addChild(_videoPlayer);
|
||||
_isFromTheater = false;
|
||||
}
|
||||
_pageNumber = 0;
|
||||
_videoPlayerId = param5;
|
||||
_streamDefs = param3;
|
||||
_spirals = [];
|
||||
_previewImages = [];
|
||||
_mediaItems = [];
|
||||
}
|
||||
|
||||
public function get videoPlayer() : VideoPlayerOSMF
|
||||
{
|
||||
return _videoPlayer;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
if(_movieSelectorPopup)
|
||||
{
|
||||
removeListeners();
|
||||
KeepAlive.stopKATimer(_movieSelectorPopup);
|
||||
_popupLayer.removeChild(_movieSelectorPopup);
|
||||
DarkenManager.unDarken(_movieSelectorPopup);
|
||||
}
|
||||
_movieSelectorPopup = null;
|
||||
_movieSelector = null;
|
||||
_isFromTheater = false;
|
||||
_isAsking = false;
|
||||
_theaterScreen = null;
|
||||
_titleTxt = null;
|
||||
if(_movieMediaHelper)
|
||||
{
|
||||
_movieMediaHelper.destroy();
|
||||
_movieMediaHelper = null;
|
||||
}
|
||||
if(_printMediaHelper)
|
||||
{
|
||||
_printMediaHelper.destroy();
|
||||
_printMediaHelper = null;
|
||||
}
|
||||
if(_mediaItems)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _mediaItems.length)
|
||||
{
|
||||
_mediaItems[_loc1_].destroy();
|
||||
_loc1_++;
|
||||
}
|
||||
_mediaItems.splice(0,_mediaItems.length);
|
||||
_mediaItems = null;
|
||||
}
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _spirals.length)
|
||||
{
|
||||
_spirals[_loc2_].destroy();
|
||||
_loc2_++;
|
||||
}
|
||||
if(_videoPlayer)
|
||||
{
|
||||
_videoPlayer.destroy();
|
||||
}
|
||||
_spirals = null;
|
||||
_previewImages = null;
|
||||
_mediaItems = null;
|
||||
_closeBtn = null;
|
||||
_leftArrow = null;
|
||||
_rightArrow = null;
|
||||
_mw0 = null;
|
||||
_mw1 = null;
|
||||
_mw2 = null;
|
||||
_mw3 = null;
|
||||
_playMovBtn0 = null;
|
||||
_playMovBtn1 = null;
|
||||
_playMovBtn2 = null;
|
||||
_playMovBtn3 = null;
|
||||
_closeCallback = null;
|
||||
}
|
||||
|
||||
public function toggleVisibility() : void
|
||||
{
|
||||
if(_movieSelectorPopup)
|
||||
{
|
||||
if(_movieSelectorPopup.visible)
|
||||
{
|
||||
DarkenManager.unDarken(_movieSelectorPopup);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.darken(_movieSelectorPopup);
|
||||
}
|
||||
_movieSelectorPopup.visible = !_movieSelectorPopup.visible;
|
||||
}
|
||||
}
|
||||
|
||||
public function setSkinFrame(param1:int) : void
|
||||
{
|
||||
_skinFrameId = param1;
|
||||
if(_movieSelector && _movieSelector.currentFrame != param1)
|
||||
{
|
||||
_movieSelector.gotoAndPlay(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function setVideoFrameId(param1:int) : void
|
||||
{
|
||||
_videoFrameId = param1;
|
||||
}
|
||||
|
||||
public function togglePlayPauseVideoPlayer(param1:Boolean) : void
|
||||
{
|
||||
if(_videoPlayer)
|
||||
{
|
||||
_videoPlayer.togglePlayPause(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function setQuestionBtn() : void
|
||||
{
|
||||
if(_movieSelector && _movieSelector.askTab)
|
||||
{
|
||||
if(_movieSelector.askTab.hasOwnProperty("askBradyBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askBradyBtn.addEventListener("mouseDown",onAskBtn,false,0,true);
|
||||
}
|
||||
else if(_movieSelector.askTab.hasOwnProperty("askCamiBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askCamiBtn.addEventListener("mouseDown",onAskBtn,false,0,true);
|
||||
}
|
||||
else if(_movieSelector.askTab.hasOwnProperty("askGabbyBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askGabbyBtn.addEventListener("mouseDown",onAskBtn,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_movieSelector.askTab.askTierneyBtn.addEventListener("mouseDown",onAskBtn,false,0,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_isAsking = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function setTitleTxt(param1:String) : void
|
||||
{
|
||||
if(_movieSelector)
|
||||
{
|
||||
LocalizationManager.translateId(_movieSelector.titleTxt,int(param1));
|
||||
}
|
||||
else
|
||||
{
|
||||
_titleTxt = param1;
|
||||
}
|
||||
}
|
||||
|
||||
public function chooseRandom(param1:Boolean, param2:int = 1, param3:Boolean = false, param4:int = 530, param5:int = 298) : void
|
||||
{
|
||||
_chooseRandom = param1;
|
||||
_randomPlayerSkinId = param2;
|
||||
if(_movieSelector && _chooseRandom)
|
||||
{
|
||||
_videoPlayer.init(_streamDefs,_videoPlayerId,-1,param3,param4,param5,onVideoPlayerClose);
|
||||
_videoPlayer.setSkinFrame(param2);
|
||||
toggleVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
public function setShouldRepeat(param1:Boolean) : void
|
||||
{
|
||||
_shouldRepeat = param1;
|
||||
}
|
||||
|
||||
public function setDefaultWidthHeight(param1:int, param2:int) : void
|
||||
{
|
||||
_defaultWidth = param1;
|
||||
_defaultHeight = param2;
|
||||
}
|
||||
|
||||
private function movieHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:MediaHelper = null;
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_movieSelectorPopup = param1;
|
||||
KeepAlive.startKATimer(_movieSelectorPopup);
|
||||
_movieSelectorPopup.visible = false;
|
||||
_popupLayer.addChild(_movieSelectorPopup);
|
||||
_movieSelector = MovieClip(_movieSelectorPopup.getChildAt(0));
|
||||
if(_movieSelector.currentFrame != _skinFrameId)
|
||||
{
|
||||
_movieSelector.gotoAndPlay(_skinFrameId);
|
||||
}
|
||||
_loc3_ = int(_streamDefs.length);
|
||||
_loc4_ = 1;
|
||||
while(_loc4_ < Math.min(5,_loc3_ + 1))
|
||||
{
|
||||
_spirals[_loc4_ - 1] = new LoadingSpiral(_movieSelector["mw" + _loc4_].itemLayer);
|
||||
_loc4_++;
|
||||
}
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc3_)
|
||||
{
|
||||
_loc2_ = new MediaHelper();
|
||||
_loc2_.init(_streamDefs.getStreamDefItem(_loc5_).thumbnailId,previewHelperCallback,true);
|
||||
_mediaItems[_loc5_] = _loc2_;
|
||||
_loc5_++;
|
||||
}
|
||||
_movieSelectorPopup.x = 900 * 0.5;
|
||||
_movieSelectorPopup.y = 550 * 0.5;
|
||||
_closeBtn = MovieClip(_movieSelectorPopup.getChildAt(0)["bx"]);
|
||||
_leftArrow = _movieSelector["arrowLBtn"];
|
||||
_rightArrow = _movieSelector["arrowRBtn"];
|
||||
_mw0 = _movieSelector["mw1"];
|
||||
_mw1 = _movieSelector["mw2"];
|
||||
_mw2 = _movieSelector["mw3"];
|
||||
_mw3 = _movieSelector["mw4"];
|
||||
_playMovBtn0 = _mw0["playMovBtn"];
|
||||
_playMovBtn1 = _mw1["playMovBtn"];
|
||||
_playMovBtn2 = _mw2["playMovBtn"];
|
||||
_playMovBtn3 = _mw3["playMovBtn"];
|
||||
_playMovBtn0.visible = false;
|
||||
_playMovBtn1.visible = false;
|
||||
_playMovBtn2.visible = false;
|
||||
_playMovBtn3.visible = false;
|
||||
_mw0.movieDescTxt.visible = false;
|
||||
_mw1.movieDescTxt.visible = false;
|
||||
_mw2.movieDescTxt.visible = false;
|
||||
_mw3.movieDescTxt.visible = false;
|
||||
_mw0.newTag.visible = false;
|
||||
_mw1.newTag.visible = false;
|
||||
_mw2.newTag.visible = false;
|
||||
_mw3.newTag.visible = false;
|
||||
_mw0.daysLeftTag.visible = false;
|
||||
_mw1.daysLeftTag.visible = false;
|
||||
_mw2.daysLeftTag.visible = false;
|
||||
_mw3.daysLeftTag.visible = false;
|
||||
if(_loc3_ <= 4)
|
||||
{
|
||||
_leftArrow.activateGrayState(true);
|
||||
_rightArrow.activateGrayState(true);
|
||||
}
|
||||
if(!_isAsking)
|
||||
{
|
||||
if(_movieSelector.askTab)
|
||||
{
|
||||
_movieSelector.askTab.visible = false;
|
||||
}
|
||||
}
|
||||
if(_titleTxt)
|
||||
{
|
||||
LocalizationManager.translateId(_movieSelector.titleTxt,int(_titleTxt));
|
||||
}
|
||||
addListeners();
|
||||
if(!_theaterScreen)
|
||||
{
|
||||
toggleVisibility();
|
||||
}
|
||||
if(_theaterScreen)
|
||||
{
|
||||
_videoPlayer.init(_streamDefs,-1,-1);
|
||||
}
|
||||
if(_chooseRandom)
|
||||
{
|
||||
_videoPlayer.init(_streamDefs,_theaterScreen ? -1 : _videoPlayerId,-1,_shouldRepeat,512,288,onVideoPlayerClose);
|
||||
_videoPlayer.setSkinFrame(_randomPlayerSkinId);
|
||||
toggleVisibility();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onVideoPlayerClose() : void
|
||||
{
|
||||
onClose(null);
|
||||
}
|
||||
|
||||
private function addListeners() : void
|
||||
{
|
||||
_closeBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_playMovBtn0.addEventListener("mouseDown",onPlay,false,0,true);
|
||||
_playMovBtn1.addEventListener("mouseDown",onPlay,false,0,true);
|
||||
_playMovBtn2.addEventListener("mouseDown",onPlay,false,0,true);
|
||||
_playMovBtn3.addEventListener("mouseDown",onPlay,false,0,true);
|
||||
_leftArrow.addEventListener("mouseDown",onSideBtn,false,0,true);
|
||||
_rightArrow.addEventListener("mouseDown",onSideBtn,false,0,true);
|
||||
_movieSelectorPopup.addEventListener("mouseDown",onMoviePopup,false,0,true);
|
||||
if(_isAsking)
|
||||
{
|
||||
if(_movieSelector.askTab)
|
||||
{
|
||||
if(_movieSelector.askTab.hasOwnProperty("askBradyBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askBradyBtn.addEventListener("mouseDown",onAskBtn,false,0,true);
|
||||
}
|
||||
else if(_movieSelector.askTab.hasOwnProperty("askCamiBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askCamiBtn.addEventListener("mouseDown",onAskBtn,false,0,true);
|
||||
}
|
||||
else if(_movieSelector.askTab.hasOwnProperty("askGabbyBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askGabbyBtn.addEventListener("mouseDown",onAskBtn,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_movieSelector.askTab.askTierneyBtn.addEventListener("mouseDown",onAskBtn,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function removeListeners() : void
|
||||
{
|
||||
_closeBtn.removeEventListener("mouseDown",onClose);
|
||||
_playMovBtn0.removeEventListener("mouseDown",onPlay);
|
||||
_playMovBtn1.removeEventListener("mouseDown",onPlay);
|
||||
_playMovBtn2.removeEventListener("mouseDown",onPlay);
|
||||
_playMovBtn3.removeEventListener("mouseDown",onPlay);
|
||||
_leftArrow.removeEventListener("mouseDown",onSideBtn);
|
||||
_rightArrow.removeEventListener("mouseDown",onSideBtn);
|
||||
_movieSelectorPopup.removeEventListener("mouseDown",onMoviePopup);
|
||||
if(_isAsking)
|
||||
{
|
||||
if(_movieSelector.askTab)
|
||||
{
|
||||
if(_movieSelector.askTab.hasOwnProperty("askBradyBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askBradyBtn.removeEventListener("mouseDown",onAskBtn);
|
||||
}
|
||||
else if(_movieSelector.askTab.hasOwnProperty("askCamiBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askCamiBtn.removeEventListener("mouseDown",onAskBtn);
|
||||
}
|
||||
else if(_movieSelector.askTab.hasOwnProperty("askGabbyBtn"))
|
||||
{
|
||||
_movieSelector.askTab.askGabbyBtn.removeEventListener("mouseDown",onAskBtn);
|
||||
}
|
||||
else
|
||||
{
|
||||
_movieSelector.askTab.askTierneyBtn.removeEventListener("mouseDown",onAskBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onMoviePopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
if(!_chooseRandom)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onAskBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
if(param1.currentTarget.name == "askBradyBtn")
|
||||
{
|
||||
FeedbackManager.openFeedbackPopup(1);
|
||||
}
|
||||
else if(param1.currentTarget.name == "askCamiBtn")
|
||||
{
|
||||
FeedbackManager.openFeedbackPopup(21);
|
||||
}
|
||||
else if(param1.currentTarget.name == "askGabbyBtn")
|
||||
{
|
||||
FeedbackManager.openFeedbackPopup(22);
|
||||
}
|
||||
else
|
||||
{
|
||||
FeedbackManager.openFeedbackPopup(11);
|
||||
}
|
||||
}
|
||||
|
||||
private function previewHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
var _loc3_:MovieClip = null;
|
||||
var _loc5_:StreamDef = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc2_:Object = null;
|
||||
if(_mediaItems)
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _mediaItems.length)
|
||||
{
|
||||
if(_mediaItems[_loc6_] == param1.mediaHelper)
|
||||
{
|
||||
_previewImages[_loc6_] = param1;
|
||||
if(_loc6_ < 4)
|
||||
{
|
||||
_loc5_ = _streamDefs.getStreamDefItem(_loc6_);
|
||||
_loc3_ = this["_mw" + _loc6_];
|
||||
_spirals[_loc6_].destroy();
|
||||
_loc3_.movieDescTxt.visible = true;
|
||||
_loc3_.playMovBtn.visible = true;
|
||||
_loc3_.itemLayer.addChild(param1);
|
||||
LocalizationManager.translateId(_loc3_.movieDescTxt,_loc5_.baseTitleId);
|
||||
_loc3_.newTag.visible = _loc5_.isNew;
|
||||
_loc2_ = param1.getChildAt(0);
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc2_.numChildren)
|
||||
{
|
||||
if(_loc2_.getChildAt(_loc4_).name.indexOf("beakerBtn") >= 0)
|
||||
{
|
||||
_loc2_.getChildAt(_loc4_).addEventListener("mouseDown",onBeakerDown,false,0,true);
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
if(_mediaItems.length < 4)
|
||||
{
|
||||
_loc4_ = int(_mediaItems.length);
|
||||
while(_loc4_ < 4)
|
||||
{
|
||||
this["_mw" + _loc4_].visible = false;
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function reloadPreviews() : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc4_:StreamDef = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc1_:Object = null;
|
||||
_loc3_ = 1;
|
||||
while(_loc3_ < 5)
|
||||
{
|
||||
while(_movieSelector["mw" + _loc3_].itemLayer.numChildren > 0)
|
||||
{
|
||||
_movieSelector["mw" + _loc3_].itemLayer.removeChildAt(0);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
_loc5_ = _pageNumber;
|
||||
while(_loc5_ < _pageNumber + 4)
|
||||
{
|
||||
_loc2_ = this["_mw" + (_loc5_ - _pageNumber)];
|
||||
if(_loc5_ < _previewImages.length)
|
||||
{
|
||||
_loc4_ = _streamDefs.getStreamDefItem(_loc5_);
|
||||
_loc2_.visible = true;
|
||||
_loc2_.itemLayer.addChild(_previewImages[_loc5_]);
|
||||
_loc2_.playMovBtn.visible = true;
|
||||
LocalizationManager.translateId(_loc2_.movieDescTxt,_loc4_.baseTitleId);
|
||||
_loc2_.newTag.visible = _loc4_.isNew;
|
||||
_loc1_ = _previewImages[_loc5_].getChildAt(0);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc1_.numChildren)
|
||||
{
|
||||
if(_loc1_.getChildAt(_loc3_).name.indexOf("beakerBtn") > 0)
|
||||
{
|
||||
_loc1_.getChildAt(_loc3_).addEventListener("mouseDown",onBeakerDown,false,0,true);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_.visible = false;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPlay(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
param1.stopPropagation();
|
||||
switch(param1.currentTarget.parent.name)
|
||||
{
|
||||
case "mw1":
|
||||
break;
|
||||
case "mw2":
|
||||
_loc2_ = 1;
|
||||
break;
|
||||
case "mw3":
|
||||
_loc2_ = 2;
|
||||
break;
|
||||
case "mw4":
|
||||
_loc2_ = 3;
|
||||
}
|
||||
if(_streamDefs.length > _loc2_ + _pageNumber)
|
||||
{
|
||||
if(_chooseRandom || _isFromTheater)
|
||||
{
|
||||
_videoPlayer.playVideoIdx(_pageNumber + _loc2_);
|
||||
onClose(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_videoPlayer.init(_streamDefs,_videoPlayerId,_pageNumber + _loc2_,_shouldRepeat,_defaultWidth,_defaultHeight);
|
||||
_videoPlayer.setSkinFrame(_videoFrameId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onSideBtn(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
param1.stopPropagation();
|
||||
var _loc3_:* = param1.currentTarget.name;
|
||||
if("arrowLBtn" !== _loc3_)
|
||||
{
|
||||
if(_pageNumber + 4 < _streamDefs.length)
|
||||
{
|
||||
_pageNumber += 4;
|
||||
reloadPreviews();
|
||||
}
|
||||
else
|
||||
{
|
||||
_pageNumber = 0;
|
||||
reloadPreviews();
|
||||
}
|
||||
}
|
||||
else if(_pageNumber - 4 >= 0)
|
||||
{
|
||||
_pageNumber -= 4;
|
||||
reloadPreviews();
|
||||
}
|
||||
else if(_streamDefs.length > 4)
|
||||
{
|
||||
_loc2_ = _streamDefs.length % 4;
|
||||
_pageNumber = _streamDefs.length;
|
||||
var _temp_5:* = §§findproperty(_pageNumber);
|
||||
_pageNumber -= _loc2_ == 0 ? 4 : _loc2_;
|
||||
reloadPreviews();
|
||||
}
|
||||
}
|
||||
|
||||
private function onBeakerDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
new SBYesNoPopup(_popupLayer,LocalizationManager.translateIdOnly(14808),true,onConfirmPrint,param1.currentTarget.name.split("_"));
|
||||
}
|
||||
|
||||
private function onConfirmPrint(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1.status)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_numPrintItemsToLoad = param1.passback.length - 1;
|
||||
_numPrintItemsLoaded = 0;
|
||||
_printMediaHolder = [];
|
||||
_loadedImages = [];
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < param1.passback.length)
|
||||
{
|
||||
_printMediaHelper = new MediaHelper();
|
||||
_printMediaHelper.init(param1.passback[_loc2_],onPrintMediaLoaded,_loc2_);
|
||||
_printMediaHolder.push(_printMediaHelper);
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onPrintMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc3_:PrintJob = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:Array = null;
|
||||
var _loc5_:Object = null;
|
||||
_loadedImages[param1.passback - 1] = param1;
|
||||
_numPrintItemsLoaded = _numPrintItemsLoaded + 1;
|
||||
if(_numPrintItemsLoaded == _numPrintItemsToLoad)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_loc3_ = new PrintJob();
|
||||
if(_loc3_.start())
|
||||
{
|
||||
_loc4_ = [];
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loadedImages.length)
|
||||
{
|
||||
_loc5_ = setupPrintSprite(_loadedImages[_loc2_],_loc3_);
|
||||
_loc4_.push(_loc5_.spriteToPrint);
|
||||
_printMediaHolder[_loc2_].destroy();
|
||||
try
|
||||
{
|
||||
_loc3_.addPage(_loc5_.spriteToPrint,new Rectangle(0,0,_loc5_.realW + 2,_loc5_.realH + 2));
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
_loc5_ = null;
|
||||
}
|
||||
_loadedImages = null;
|
||||
_printMediaHolder = null;
|
||||
_loc3_.send();
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc4_.length)
|
||||
{
|
||||
if(_loc4_[_loc2_].parent)
|
||||
{
|
||||
gMainFrame.stage.removeChild(_loc4_[_loc2_]);
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
_loc4_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function setupPrintSprite(param1:MovieClip, param2:PrintJob) : Object
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc3_:Sprite = new Sprite();
|
||||
param1.scaleX = param1.scaleY = 4;
|
||||
_loc3_.addChild(param1);
|
||||
param1.x = param1.y = 1;
|
||||
var _loc7_:Number = _loc3_.width;
|
||||
var _loc9_:Number = _loc3_.height;
|
||||
var _loc8_:BitmapData = new BitmapData(_loc3_.width,_loc3_.height,false,4294967295);
|
||||
_loc8_.draw(_loc3_);
|
||||
var _loc10_:Bitmap = new Bitmap(_loc8_);
|
||||
var _loc6_:Sprite = new Sprite();
|
||||
_loc6_.addChild(_loc10_);
|
||||
_loc10_.x = 0;
|
||||
_loc10_.y = 0;
|
||||
_loc10_.scaleX = 0.999;
|
||||
_loc10_.scaleY = 0.999;
|
||||
_loc6_.x = 0;
|
||||
_loc6_.y = 0;
|
||||
gMainFrame.stage.addChild(_loc6_);
|
||||
_loc6_.visible = false;
|
||||
if(param2.orientation != "portrait")
|
||||
{
|
||||
_loc6_.rotation = 90;
|
||||
_loc6_.x = _loc6_.width;
|
||||
_loc5_ = param2.pageWidth / _loc9_;
|
||||
_loc4_ = param2.pageHeight / _loc7_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = param2.pageWidth / _loc7_;
|
||||
_loc4_ = param2.pageHeight / _loc9_;
|
||||
}
|
||||
_loc6_.scaleX = _loc6_.scaleY = Math.min(_loc5_,_loc4_);
|
||||
return {
|
||||
"spriteToPrint":_loc6_,
|
||||
"realW":_loc7_,
|
||||
"realH":_loc9_
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package movie
|
||||
{
|
||||
public class MovieNode
|
||||
{
|
||||
|
||||
private var _titleId:int;
|
||||
|
||||
private var _streamId:int;
|
||||
|
||||
private var _streamTitleId:int;
|
||||
|
||||
private var _mediaId:int;
|
||||
|
||||
private var _iconMediaId:int;
|
||||
|
||||
private var _thumbMediaId:int;
|
||||
|
||||
private var _choices:Object;
|
||||
|
||||
private var _denRewardId:int;
|
||||
|
||||
private var _userVarId:int;
|
||||
|
||||
private var _bitIndex:int;
|
||||
|
||||
private var _defId:int;
|
||||
|
||||
private var _numChoices:int;
|
||||
|
||||
private var _hasChosenThisChoice:Boolean;
|
||||
|
||||
private var _subtitleId:int;
|
||||
|
||||
protected var _thisChapterHasGift:Boolean;
|
||||
|
||||
protected var _isChapter:Boolean;
|
||||
|
||||
public function MovieNode(param1:Object)
|
||||
{
|
||||
super();
|
||||
_defId = param1.defId;
|
||||
_titleId = param1.titleStrRef;
|
||||
_streamId = param1.streamRefId;
|
||||
_streamTitleId = param1.streamTitleStrRef;
|
||||
_mediaId = param1.mediaRefId;
|
||||
_iconMediaId = param1.iconMediaRefId;
|
||||
_thumbMediaId = param1.thumbMediaRefId;
|
||||
_choices = {
|
||||
"choice1Id":param1.choice1MovieNodeRefId,
|
||||
"choice2Id":param1.choice2MovieNodeRefId,
|
||||
"choice3Id":param1.choice3MovieNodeRefId
|
||||
};
|
||||
_denRewardId = param1.denItemRefId;
|
||||
_userVarId = param1.userVarRefId;
|
||||
_bitIndex = param1.userVarBit;
|
||||
_numChoices = param1.numChoices;
|
||||
_subtitleId = param1.subtitleId;
|
||||
param1 = null;
|
||||
}
|
||||
|
||||
public function get defId() : int
|
||||
{
|
||||
return _defId;
|
||||
}
|
||||
|
||||
public function get titleId() : int
|
||||
{
|
||||
return _titleId;
|
||||
}
|
||||
|
||||
public function get streamId() : int
|
||||
{
|
||||
return _streamId;
|
||||
}
|
||||
|
||||
public function get streamTitleId() : int
|
||||
{
|
||||
return _streamTitleId;
|
||||
}
|
||||
|
||||
public function get mediaId() : int
|
||||
{
|
||||
return _mediaId;
|
||||
}
|
||||
|
||||
public function get iconMediaId() : int
|
||||
{
|
||||
return _iconMediaId;
|
||||
}
|
||||
|
||||
public function get thumbMediaId() : int
|
||||
{
|
||||
return _thumbMediaId;
|
||||
}
|
||||
|
||||
public function getChoiceById(param1:int) : int
|
||||
{
|
||||
return _choices["choice" + param1 + "Id"];
|
||||
}
|
||||
|
||||
public function get choice1Id() : int
|
||||
{
|
||||
return _choices.choice1Id;
|
||||
}
|
||||
|
||||
public function get choice2Id() : int
|
||||
{
|
||||
return _choices.choice2Id;
|
||||
}
|
||||
|
||||
public function get choice3Id() : int
|
||||
{
|
||||
return _choices.choice3Id;
|
||||
}
|
||||
|
||||
public function get denRewardId() : int
|
||||
{
|
||||
return _denRewardId;
|
||||
}
|
||||
|
||||
public function get userVarId() : int
|
||||
{
|
||||
return _userVarId;
|
||||
}
|
||||
|
||||
public function get bitIndex() : int
|
||||
{
|
||||
return _bitIndex;
|
||||
}
|
||||
|
||||
public function get numChoices() : int
|
||||
{
|
||||
return _numChoices;
|
||||
}
|
||||
|
||||
public function set thisChapterHasGift(param1:Boolean) : void
|
||||
{
|
||||
_thisChapterHasGift = param1;
|
||||
}
|
||||
|
||||
public function get thisChapterHasGift() : Boolean
|
||||
{
|
||||
return _thisChapterHasGift;
|
||||
}
|
||||
|
||||
public function get isChapter() : Boolean
|
||||
{
|
||||
return _isChapter;
|
||||
}
|
||||
|
||||
public function set isChapter(param1:Boolean) : void
|
||||
{
|
||||
_isChapter = param1;
|
||||
}
|
||||
|
||||
public function get hasChosenThisChoice() : Boolean
|
||||
{
|
||||
return _hasChosenThisChoice;
|
||||
}
|
||||
|
||||
public function set hasChosenThisChoice(param1:Boolean) : void
|
||||
{
|
||||
_hasChosenThisChoice = param1;
|
||||
}
|
||||
|
||||
public function get subtitleId() : int
|
||||
{
|
||||
return _subtitleId;
|
||||
}
|
||||
|
||||
public function set subtitleId(param1:int) : void
|
||||
{
|
||||
_subtitleId = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package movie
|
||||
{
|
||||
public class MovieTreeNode extends MovieNode
|
||||
{
|
||||
|
||||
private var _isCorrectChoice:Boolean;
|
||||
|
||||
private var _nodeIndex:int;
|
||||
|
||||
private var _parentDefId:int;
|
||||
|
||||
public function MovieTreeNode(param1:Object)
|
||||
{
|
||||
super(param1);
|
||||
nodeIndex = 1;
|
||||
}
|
||||
|
||||
public function get isCorrectChoice() : Boolean
|
||||
{
|
||||
return _isCorrectChoice;
|
||||
}
|
||||
|
||||
public function set isCorrectChoice(param1:Boolean) : void
|
||||
{
|
||||
_isCorrectChoice = param1;
|
||||
}
|
||||
|
||||
public function get nodeIndex() : int
|
||||
{
|
||||
return _nodeIndex;
|
||||
}
|
||||
|
||||
public function set nodeIndex(param1:int) : void
|
||||
{
|
||||
_nodeIndex = param1;
|
||||
}
|
||||
|
||||
public function get parentDefId() : int
|
||||
{
|
||||
return _parentDefId;
|
||||
}
|
||||
|
||||
public function set parentDefId(param1:int) : void
|
||||
{
|
||||
_parentDefId = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
package movie
|
||||
{
|
||||
import loader.DefPacksDefHelper;
|
||||
|
||||
public class MovieXtCommManager
|
||||
{
|
||||
|
||||
private static var _movieNodeDefs:Object;
|
||||
|
||||
private static var _movieTrees:Object = {};
|
||||
|
||||
public function MovieXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function movieNodeResponse(param1:DefPacksDefHelper) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc5_:Object = param1.def;
|
||||
DefPacksDefHelper.mediaArray[1053] = null;
|
||||
var _loc4_:Object = {};
|
||||
for each(var _loc2_:Object in param1.def)
|
||||
{
|
||||
_loc3_ = {
|
||||
"choice1MovieNodeRefId":int(_loc2_.choice1MovieNodeRefId),
|
||||
"choice2MovieNodeRefId":int(_loc2_.choice2MovieNodeRefId),
|
||||
"choice3MovieNodeRefId":int(_loc2_.choice3MovieNodeRefId),
|
||||
"mediaRefId":int(_loc2_.mediaRefId),
|
||||
"iconMediaRefId":int(_loc2_.iconMediaRefId),
|
||||
"thumbMediaRefId":int(_loc2_.thumbMediaRefId),
|
||||
"denItemRefId":int(_loc2_.denItemRefId),
|
||||
"titleStrRef":int(_loc2_.titleStrRef),
|
||||
"streamRefId":int(_loc2_.streamRefId),
|
||||
"streamTitleStrRef":int(_loc2_.streamTitleStrRef),
|
||||
"userVarRefId":int(_loc2_.userVarRefId),
|
||||
"userVarBit":int(_loc2_.userVarBit),
|
||||
"subtitleId":int(_loc2_.subtitleRefId),
|
||||
"defId":int(_loc2_.id),
|
||||
"numChoices":0
|
||||
};
|
||||
_loc3_.numChoices = _loc3_.choice3MovieNodeRefId > 0 ? 3 : (_loc3_.choice2MovieNodeRefId > 0 ? 2 : (_loc3_.choice1MovieNodeRefId > 0 ? 1 : 0));
|
||||
_loc4_[_loc3_.defId] = _loc3_;
|
||||
}
|
||||
_movieNodeDefs = _loc4_;
|
||||
getAllContinuingNodes(1);
|
||||
}
|
||||
|
||||
public static function get movieDefs() : Object
|
||||
{
|
||||
return _movieNodeDefs;
|
||||
}
|
||||
|
||||
public static function getMovieDef(param1:int) : MovieNode
|
||||
{
|
||||
return new MovieNode(_movieNodeDefs[param1]);
|
||||
}
|
||||
|
||||
public static function getMovieNodeFromTree(param1:int, param2:int) : MovieNode
|
||||
{
|
||||
if(_movieTrees[param1] != null)
|
||||
{
|
||||
return _movieTrees[param1][param2];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getAllContinuingNodes(param1:int) : Array
|
||||
{
|
||||
if(_movieTrees[param1] == null)
|
||||
{
|
||||
_movieTrees[param1] = {};
|
||||
_movieTrees[param1][param1] = getTreeMovieDef(param1);
|
||||
buildNodeTree(_movieTrees[param1][param1],param1);
|
||||
}
|
||||
var _loc2_:Array = [];
|
||||
for each(var _loc3_:MovieTreeNode in _movieTrees[param1])
|
||||
{
|
||||
if(_loc3_.isCorrectChoice)
|
||||
{
|
||||
_loc2_.push(_loc3_);
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public static function getAllChapters(param1:int) : Array
|
||||
{
|
||||
if(_movieTrees[param1] == null)
|
||||
{
|
||||
_movieTrees[param1] = {};
|
||||
_movieTrees[param1][param1] = getTreeMovieDef(param1);
|
||||
buildNodeTree(_movieTrees[param1][param1],param1);
|
||||
}
|
||||
var _loc2_:Array = [];
|
||||
for each(var _loc3_:MovieTreeNode in _movieTrees[param1])
|
||||
{
|
||||
if(_loc3_.isChapter)
|
||||
{
|
||||
_loc2_.push(_loc3_);
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public static function resetAllChosenChapters(param1:int) : void
|
||||
{
|
||||
for each(var _loc2_:MovieTreeNode in _movieTrees[param1])
|
||||
{
|
||||
if(_loc2_.hasChosenThisChoice)
|
||||
{
|
||||
_loc2_.hasChosenThisChoice = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function getTreeMovieDef(param1:int) : MovieTreeNode
|
||||
{
|
||||
return new MovieTreeNode(_movieNodeDefs[param1]);
|
||||
}
|
||||
|
||||
private static function contains(param1:int, param2:int) : int
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
if(_movieTrees[param1] != null)
|
||||
{
|
||||
_loc4_ = int(_movieTrees[param1].length);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc4_)
|
||||
{
|
||||
if(_movieTrees[param1][_loc3_].defId == param2)
|
||||
{
|
||||
return _loc3_;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static function buildNodeTree(param1:MovieTreeNode, param2:int) : void
|
||||
{
|
||||
var _loc3_:MovieTreeNode = null;
|
||||
if(param1.nodeIndex > 3)
|
||||
{
|
||||
if(param1.defId != param2)
|
||||
{
|
||||
_loc3_ = _movieTrees[param2][param1.parentDefId];
|
||||
_loc3_.nodeIndex++;
|
||||
buildNodeTree(_loc3_,param2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(param1.getChoiceById(param1.nodeIndex) == 0)
|
||||
{
|
||||
if(param1.defId == param2)
|
||||
{
|
||||
param1.nodeIndex++;
|
||||
buildNodeTree(param1,param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(param1.userVarId != 0)
|
||||
{
|
||||
param1.isChapter = true;
|
||||
}
|
||||
if(param1.denRewardId > 0)
|
||||
{
|
||||
if(param1.isChapter)
|
||||
{
|
||||
param1.thisChapterHasGift = true;
|
||||
}
|
||||
else if(param1.parentDefId != 0)
|
||||
{
|
||||
_movieTrees[param2][param1.parentDefId].thisChapterHasGift = true;
|
||||
}
|
||||
}
|
||||
param1.isCorrectChoice = true;
|
||||
_loc3_ = _movieTrees[param2][param1.parentDefId];
|
||||
_loc3_.nodeIndex++;
|
||||
buildNodeTree(_loc3_,param2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var _loc4_:MovieTreeNode = getTreeMovieDef(param1.getChoiceById(param1.nodeIndex));
|
||||
if(_loc4_ == null || _loc4_.nodeIndex > 3)
|
||||
{
|
||||
throw new Error("CurrChoiceNode was null or we are past 3rd index");
|
||||
}
|
||||
if(_loc4_.defId == param1.parentDefId)
|
||||
{
|
||||
param1.isChapter = false;
|
||||
_loc3_ = _movieTrees[param2][_loc4_.defId];
|
||||
if(_loc3_.defId != _loc4_.defId)
|
||||
{
|
||||
throw new Error("Parent def id did not match current choices def id");
|
||||
}
|
||||
_loc3_.nodeIndex++;
|
||||
buildNodeTree(_loc3_,param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(param1.userVarId != 0)
|
||||
{
|
||||
param1.isChapter = true;
|
||||
}
|
||||
if(param1.denRewardId > 0)
|
||||
{
|
||||
if(param1.isChapter)
|
||||
{
|
||||
param1.thisChapterHasGift = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_movieTrees[param2][param1.parentDefId].thisChapterHasGift = true;
|
||||
}
|
||||
}
|
||||
param1.isCorrectChoice = true;
|
||||
_movieTrees[param2][_loc4_.defId] = _loc4_;
|
||||
_loc4_.parentDefId = param1.defId;
|
||||
buildNodeTree(_loc4_,param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,813 @@
|
||||
package movie
|
||||
{
|
||||
import Enums.StreamDef;
|
||||
import avatar.UserCommXtCommManager;
|
||||
import collection.StreamDefCollection;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.corelib.audio.SBAudio;
|
||||
import com.sbi.loader.LoaderCache;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
import flash.utils.Timer;
|
||||
import flash.utils.getDefinitionByName;
|
||||
import game.MinigameManager;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import gui.LoadingSpiral;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import org.osmf.captioning.model.Caption;
|
||||
import org.osmf.captioning.model.CaptionFormat;
|
||||
import org.osmf.captioning.model.CaptionStyle;
|
||||
import org.osmf.containers.MediaContainer;
|
||||
import org.osmf.elements.VideoElement;
|
||||
import org.osmf.events.BufferEvent;
|
||||
import org.osmf.events.DisplayObjectEvent;
|
||||
import org.osmf.events.LoadEvent;
|
||||
import org.osmf.events.MediaElementEvent;
|
||||
import org.osmf.events.MediaErrorEvent;
|
||||
import org.osmf.events.MediaFactoryEvent;
|
||||
import org.osmf.events.MediaPlayerCapabilityChangeEvent;
|
||||
import org.osmf.events.MediaPlayerStateChangeEvent;
|
||||
import org.osmf.events.PlayEvent;
|
||||
import org.osmf.events.TimeEvent;
|
||||
import org.osmf.events.TimelineMetadataEvent;
|
||||
import org.osmf.media.DefaultMediaFactory;
|
||||
import org.osmf.media.MediaElement;
|
||||
import org.osmf.media.MediaFactoryItem;
|
||||
import org.osmf.media.MediaPlayer;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.media.PluginInfoResource;
|
||||
import org.osmf.media.URLResource;
|
||||
import org.osmf.metadata.Metadata;
|
||||
import org.osmf.metadata.TimelineMetadata;
|
||||
import org.osmf.net.DynamicStreamingResource;
|
||||
import org.osmf.net.NetLoader;
|
||||
import org.osmf.net.StreamingURLResource;
|
||||
import org.osmf.utils.FCSubscribeHandler;
|
||||
|
||||
public class VideoPlayerOSMF extends Sprite
|
||||
{
|
||||
|
||||
private var _videoMediaHelper:MediaHelper;
|
||||
|
||||
private var _playerPopup:MovieClip;
|
||||
|
||||
private var _videoLayer:Sprite;
|
||||
|
||||
private var _videoPlayer:MediaPlayer;
|
||||
|
||||
private var _loadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _streamDefs:StreamDefCollection;
|
||||
|
||||
private var _currStreamDef:StreamDef;
|
||||
|
||||
private var _currVideoIdx:int;
|
||||
|
||||
private var _loadText:TextField;
|
||||
|
||||
private var _hasMediaId:Boolean;
|
||||
|
||||
private var _skinFrameId:int = 1;
|
||||
|
||||
private var _subTitleTextField:TextField;
|
||||
|
||||
private var _graySubtitleBox:MovieClip;
|
||||
|
||||
private var _musicMutedByPlayer:Boolean;
|
||||
|
||||
private var _isReady:Boolean;
|
||||
|
||||
private var _pausedByUser:Boolean;
|
||||
|
||||
private var _readyToStart:Boolean;
|
||||
|
||||
private var _popupLoaded:Boolean;
|
||||
|
||||
private var _netConnected:Boolean;
|
||||
|
||||
private var _playerWidth:int;
|
||||
|
||||
private var _playerHeight:int;
|
||||
|
||||
private var _info:Object;
|
||||
|
||||
private var _shouldRepeatSingleMovie:Boolean;
|
||||
|
||||
private var _container:MediaContainer;
|
||||
|
||||
private var _videoElement:MediaElement;
|
||||
|
||||
private var _mediaFactory:DefaultMediaFactory;
|
||||
|
||||
private var _FCS:FCSubscribeHandler;
|
||||
|
||||
private var _isLive:Boolean;
|
||||
|
||||
private var _bufferTimer:Timer;
|
||||
|
||||
private var _startUpTimer:Timer;
|
||||
|
||||
private var _captionMetadata:TimelineMetadata;
|
||||
|
||||
private var _theaterWindow:MovieClip;
|
||||
|
||||
private var _mouseOverTimer:Timer;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
public function VideoPlayerOSMF()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:StreamDefCollection, param2:int = -1, param3:int = -1, param4:Boolean = true, param5:Number = 512, param6:Number = 288, param7:Function = null) : void
|
||||
{
|
||||
_streamDefs = param1;
|
||||
_playerWidth = param5;
|
||||
_playerHeight = param6;
|
||||
_shouldRepeatSingleMovie = param4;
|
||||
_currVideoIdx = param3;
|
||||
_closeCallback = param7;
|
||||
_mouseOverTimer = new Timer(10,300);
|
||||
_mouseOverTimer.addEventListener("timer",onMouseOverTimer,false,0,true);
|
||||
if(_currVideoIdx >= _streamDefs.length || _currVideoIdx < 0)
|
||||
{
|
||||
_currVideoIdx = Math.round(Math.random() * (_streamDefs.length - 1));
|
||||
}
|
||||
_currStreamDef = _streamDefs.getStreamDefItem(_currVideoIdx);
|
||||
if(param2 >= 0)
|
||||
{
|
||||
_videoMediaHelper = new MediaHelper();
|
||||
_videoMediaHelper.init(param2,mediaHelperCallback);
|
||||
_hasMediaId = true;
|
||||
}
|
||||
_startUpTimer = new Timer(5000);
|
||||
_videoPlayer = new MediaPlayer();
|
||||
_container = new MediaContainer();
|
||||
_mediaFactory = new DefaultMediaFactory();
|
||||
if(LocalizationManager.currentLanguage != LocalizationManager.LANG_ENG)
|
||||
{
|
||||
loadPlugin("org.osmf.captioning.CaptioningPluginInfo");
|
||||
}
|
||||
_container.width = _playerWidth;
|
||||
_container.height = _playerHeight;
|
||||
_videoPlayer.autoPlay = true;
|
||||
_videoPlayer.autoRewind = param4;
|
||||
_videoPlayer.addEventListener("canPlayChange",canPlay,false,0,true);
|
||||
_videoPlayer.addEventListener("playStateChange",onStateChange,false,0,true);
|
||||
_videoPlayer.addEventListener("bufferingChange",onBufferChange,false,0,true);
|
||||
_videoPlayer.addEventListener("mediaPlayerStateChange",onMediaPlayerStateChange,false,0,true);
|
||||
_videoPlayer.addEventListener("mediaSizeChange",onMediaSizeChange,false,0,true);
|
||||
_videoPlayer.addEventListener("complete",completeHandler,false,0,true);
|
||||
if(_hasMediaId)
|
||||
{
|
||||
_videoPlayer.addEventListener("bytesLoadedChange",onBytesLoadedChange,false,0,true);
|
||||
}
|
||||
if(_isLive)
|
||||
{
|
||||
_videoPlayer.addEventListener("bufferLengthChange",onBufferLengthChange,false,0,true);
|
||||
}
|
||||
_videoPlayer.currentTimeUpdateInterval = 100;
|
||||
if(_hasMediaId)
|
||||
{
|
||||
_container.x -= _playerWidth * 0.5;
|
||||
_container.y -= _playerHeight * 0.5;
|
||||
UserCommXtCommManager.sendPermEmote(542);
|
||||
SBTracker.push();
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_theaterWindow = MovieClip(this.parent);
|
||||
_theaterWindow.parent.mouseEnabled = true;
|
||||
_theaterWindow.parent.mouseChildren = true;
|
||||
_loadingSpiral = new LoadingSpiral(_theaterWindow,_theaterWindow.width * 0.5,_theaterWindow.height * 0.5);
|
||||
_theaterWindow.hoverState.addEventListener("mouseDown",onPlayPauseBtn,false,0,true);
|
||||
_theaterWindow.hoverState.addEventListener("rollOut",onRollOut,false,0,true);
|
||||
_theaterWindow.hoverState.addEventListener("rollOver",onRollOver,false,0,true);
|
||||
_theaterWindow.playPauseBtn.visible = false;
|
||||
_theaterWindow.playPauseBtn.gotoAndStop("pause");
|
||||
_theaterWindow.videoLayer.addChild(_container);
|
||||
_subTitleTextField = _theaterWindow.subtitle;
|
||||
_subTitleTextField.htmlText = "";
|
||||
_graySubtitleBox = _theaterWindow.grayBox;
|
||||
_graySubtitleBox.visible = false;
|
||||
_popupLoaded = true;
|
||||
playVideoIdx(_currVideoIdx);
|
||||
}
|
||||
}
|
||||
|
||||
private function loadPlugin(param1:String) : void
|
||||
{
|
||||
var _loc2_:MediaResourceBase = null;
|
||||
var _loc3_:Class = null;
|
||||
if(param1.substr(0,4) == "http" || param1.substr(0,4) == "file")
|
||||
{
|
||||
_loc2_ = new URLResource(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = getDefinitionByName(param1) as Class;
|
||||
_loc2_ = new PluginInfoResource(new _loc3_());
|
||||
}
|
||||
loadPluginFromResource(_loc2_);
|
||||
}
|
||||
|
||||
private function loadPluginFromResource(param1:MediaResourceBase) : void
|
||||
{
|
||||
_mediaFactory.addEventListener("pluginLoad",onPluginLoaded);
|
||||
_mediaFactory.addEventListener("pluginLoadError",onPluginLoadFailed);
|
||||
_mediaFactory.loadPlugin(param1);
|
||||
}
|
||||
|
||||
private function onPluginLoaded(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
trace("Plugin LOADED!");
|
||||
}
|
||||
|
||||
private function onPluginLoadFailed(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
trace("Plugin LOAD FAILED!");
|
||||
}
|
||||
|
||||
private function onPlayPauseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.parent.playPauseBtn.currentFrameLabel != "play")
|
||||
{
|
||||
_videoPlayer.pause();
|
||||
_mouseOverTimer.reset();
|
||||
param1.currentTarget.parent.playPauseBtn.gotoAndStop("play");
|
||||
_pausedByUser = true;
|
||||
}
|
||||
else if(param1.currentTarget.parent.playPauseBtn.currentFrameLabel != "pause")
|
||||
{
|
||||
param1.currentTarget.parent.playPauseBtn.gotoAndStop("pause");
|
||||
_videoPlayer.play();
|
||||
_mouseOverTimer.start();
|
||||
param1.currentTarget.parent.playPauseBtn.alpha = 1;
|
||||
_pausedByUser = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.parent.playPauseBtn.currentFrameLabel != "play")
|
||||
{
|
||||
_mouseOverTimer.reset();
|
||||
param1.currentTarget.parent.playPauseBtn.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.parent.playPauseBtn.currentFrameLabel != "play")
|
||||
{
|
||||
_mouseOverTimer.start();
|
||||
param1.currentTarget.parent.playPauseBtn.alpha = 1;
|
||||
param1.currentTarget.parent.playPauseBtn.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseOverTimer(param1:TimerEvent) : void
|
||||
{
|
||||
if(param1.currentTarget.currentCount > 200)
|
||||
{
|
||||
if(_theaterWindow)
|
||||
{
|
||||
_theaterWindow.playPauseBtn.alpha -= 0.01;
|
||||
}
|
||||
else if(_playerPopup)
|
||||
{
|
||||
_playerPopup.playPauseBtn.alpha -= 0.01;
|
||||
}
|
||||
if(param1.currentTarget.currentCount == _mouseOverTimer.repeatCount)
|
||||
{
|
||||
_mouseOverTimer.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onBytesLoadedChange(param1:LoadEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_playerPopup.loadTxt)
|
||||
{
|
||||
_playerPopup.loadTxt.text = int(param1.bytes / param1.currentTarget.bytesTotal * 100) + "%";
|
||||
}
|
||||
}
|
||||
|
||||
private function onBufferLengthChange(param1:BufferEvent) : void
|
||||
{
|
||||
if(param1.bufferLength <= 0.01)
|
||||
{
|
||||
_bufferTimer = new Timer(10000);
|
||||
_bufferTimer.addEventListener("timer",onCheckBufferLength);
|
||||
_bufferTimer.start();
|
||||
}
|
||||
else if(_bufferTimer)
|
||||
{
|
||||
_bufferTimer.stop();
|
||||
_bufferTimer.removeEventListener("timer",onCheckBufferLength);
|
||||
_bufferTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaPlayerStateChange(param1:MediaPlayerStateChangeEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.state == "buffering")
|
||||
{
|
||||
}
|
||||
if(param1.state == "playing")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private function onCheckBufferLength(param1:TimerEvent) : void
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,"This video is not available anymore.");
|
||||
}
|
||||
|
||||
private function onBufferChange(param1:BufferEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.buffering)
|
||||
{
|
||||
addSpiral();
|
||||
}
|
||||
else
|
||||
{
|
||||
removeSpiral();
|
||||
}
|
||||
}
|
||||
|
||||
private function onTimeEvent(param1:TimeEvent) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function canPlay(param1:MediaPlayerCapabilityChangeEvent) : void
|
||||
{
|
||||
if(_startUpTimer)
|
||||
{
|
||||
_startUpTimer.addEventListener("timer",onStartupCheck);
|
||||
_startUpTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaSizeChange(param1:DisplayObjectEvent) : void
|
||||
{
|
||||
if(_startUpTimer)
|
||||
{
|
||||
_startUpTimer.stop();
|
||||
_startUpTimer.removeEventListener("timer",onStartupCheck);
|
||||
_startUpTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onStartupCheck(param1:TimerEvent) : void
|
||||
{
|
||||
_startUpTimer.stop();
|
||||
_startUpTimer.removeEventListener("timer",onStartupCheck);
|
||||
_startUpTimer = null;
|
||||
}
|
||||
|
||||
private function onStateChange(param1:PlayEvent) : void
|
||||
{
|
||||
if(param1.playState == "playing")
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/video/#" + _currStreamDef.defId);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
destroyPlayerItems();
|
||||
if(_videoMediaHelper)
|
||||
{
|
||||
_videoMediaHelper.destroy();
|
||||
_videoMediaHelper = null;
|
||||
}
|
||||
if(_playerPopup)
|
||||
{
|
||||
_playerPopup.removeEventListener("mouseDown",mouseDown);
|
||||
_playerPopup["bx"].removeEventListener("mouseDown",onClose);
|
||||
_playerPopup.hoverState.removeEventListener("mouseDown",onPlayPauseBtn);
|
||||
_playerPopup.hoverState.removeEventListener("rollOut",onRollOut);
|
||||
_playerPopup.hoverState.removeEventListener("rollOver",onRollOver);
|
||||
DarkenManager.unDarken(_playerPopup);
|
||||
GuiManager.guiLayer.removeChild(_playerPopup);
|
||||
_playerPopup.visible = false;
|
||||
_playerPopup = null;
|
||||
}
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
_currStreamDef = null;
|
||||
if(_musicMutedByPlayer)
|
||||
{
|
||||
_musicMutedByPlayer = false;
|
||||
SBAudio.unmuteMusic(false);
|
||||
}
|
||||
if(_theaterWindow)
|
||||
{
|
||||
_theaterWindow.hoverState.removeEventListener("mouseDown",onPlayPauseBtn);
|
||||
_theaterWindow.hoverState.removeEventListener("rollOut",onRollOut);
|
||||
_theaterWindow.hoverState.removeEventListener("rollOver",onRollOver);
|
||||
_theaterWindow = null;
|
||||
}
|
||||
if(!MinigameManager.inMinigame() && _hasMediaId)
|
||||
{
|
||||
UserCommXtCommManager.sendPermEmote(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleSound() : void
|
||||
{
|
||||
if(_videoPlayer.volume == 0)
|
||||
{
|
||||
_videoPlayer.volume = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_videoPlayer.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function setSkinFrame(param1:int) : void
|
||||
{
|
||||
_skinFrameId = param1;
|
||||
if(_playerPopup && _playerPopup.currentFrame != _skinFrameId)
|
||||
{
|
||||
_playerPopup.gotoAndPlay(_skinFrameId);
|
||||
}
|
||||
}
|
||||
|
||||
public function togglePlayPause(param1:Boolean) : void
|
||||
{
|
||||
if(param1 && !_pausedByUser)
|
||||
{
|
||||
_videoPlayer.play();
|
||||
}
|
||||
else
|
||||
{
|
||||
_videoPlayer.pause();
|
||||
}
|
||||
}
|
||||
|
||||
private function destroyPlayerItems() : void
|
||||
{
|
||||
if(_startUpTimer)
|
||||
{
|
||||
_startUpTimer.stop();
|
||||
_startUpTimer.removeEventListener("timer",onStartupCheck);
|
||||
_startUpTimer = null;
|
||||
}
|
||||
if(_bufferTimer)
|
||||
{
|
||||
_bufferTimer.stop();
|
||||
_bufferTimer.removeEventListener("timer",onCheckBufferLength);
|
||||
_bufferTimer = null;
|
||||
}
|
||||
if(_videoPlayer)
|
||||
{
|
||||
_videoPlayer.stop();
|
||||
_videoPlayer.media = null;
|
||||
if(_container.containsMediaElement(_videoElement))
|
||||
{
|
||||
_container.removeMediaElement(_videoElement);
|
||||
}
|
||||
while(_container.numChildren > 0)
|
||||
{
|
||||
_container.removeChildAt(0);
|
||||
}
|
||||
_videoPlayer.removeEventListener("canPlayChange",canPlay);
|
||||
_videoPlayer.removeEventListener("playStateChange",onStateChange);
|
||||
_videoPlayer.removeEventListener("bufferingChange",onBufferChange);
|
||||
_videoPlayer.removeEventListener("mediaPlayerStateChange",onMediaPlayerStateChange);
|
||||
_videoPlayer.removeEventListener("mediaSizeChange",onMediaSizeChange);
|
||||
if(_isLive)
|
||||
{
|
||||
_videoPlayer.removeEventListener("bufferLengthChange",onBufferLengthChange);
|
||||
}
|
||||
_videoElement = null;
|
||||
_container = null;
|
||||
_videoPlayer = null;
|
||||
_mediaFactory = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function mediaHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
_playerPopup = MovieClip(param1.getChildAt(0));
|
||||
if(_playerPopup.currentFrame != _skinFrameId)
|
||||
{
|
||||
_playerPopup.gotoAndPlay(_skinFrameId);
|
||||
}
|
||||
GuiManager.guiLayer.addChild(_playerPopup);
|
||||
if(_currStreamDef && _currStreamDef.individualTitleId)
|
||||
{
|
||||
LocalizationManager.translateId(_playerPopup.videoTitleTxt,_currStreamDef.individualTitleId);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateId(_playerPopup.videoTitleTxt,11392);
|
||||
}
|
||||
_playerPopup.x = 900 * 0.5;
|
||||
_playerPopup.y = 550 * 0.5;
|
||||
_playerPopup.itemLayer.addChild(_container);
|
||||
_playerPopup["bx"].addEventListener("mouseDown",onClose);
|
||||
_playerPopup.hoverState.addEventListener("mouseDown",onPlayPauseBtn);
|
||||
_playerPopup.hoverState.addEventListener("rollOut",onRollOut,false,0,true);
|
||||
_playerPopup.hoverState.addEventListener("rollOver",onRollOver,false,0,true);
|
||||
_playerPopup.playPauseBtn.visible = false;
|
||||
_playerPopup.playPauseBtn.gotoAndStop("pause");
|
||||
_playerPopup.loadTxt.text = "0%";
|
||||
_subTitleTextField = _playerPopup.subtitle;
|
||||
_subTitleTextField.htmlText = "";
|
||||
_graySubtitleBox = _playerPopup.grayBox;
|
||||
_graySubtitleBox.visible = false;
|
||||
_playerPopup.addEventListener("mouseDown",mouseDown);
|
||||
DarkenManager.darken(_playerPopup);
|
||||
_loadingSpiral = new LoadingSpiral(_playerPopup.itemLayer);
|
||||
_popupLoaded = true;
|
||||
playVideoIdx(_currVideoIdx);
|
||||
}
|
||||
}
|
||||
|
||||
public function playVideoIdx(param1:int) : void
|
||||
{
|
||||
addSpiral();
|
||||
_currVideoIdx = param1;
|
||||
_currStreamDef = _streamDefs.getStreamDefItem(_currVideoIdx);
|
||||
playNonStreaming();
|
||||
}
|
||||
|
||||
private function playNonStreaming() : void
|
||||
{
|
||||
var _loc1_:Metadata = null;
|
||||
var _loc2_:URLResource = new URLResource(LoaderCache.fetchCDNURL("streams/" + _currStreamDef.defId + ".flv"));
|
||||
onHideCaption(null);
|
||||
if(LocalizationManager.currentLanguage != LocalizationManager.LANG_ENG && _currStreamDef.subtitleId != 0)
|
||||
{
|
||||
_loc1_ = new Metadata();
|
||||
_loc1_.addValue("uri",LoaderCache.fetchCDNURL("subtitle/" + _currStreamDef.subtitleId + "/" + LocalizationManager.currentLanguage));
|
||||
MediaResourceBase(_loc2_).addMetadataValue("http://www.osmf.org/captioning/1.0",_loc1_);
|
||||
}
|
||||
var _loc3_:NetLoader = new NetLoader();
|
||||
_mediaFactory.addItem(new MediaFactoryItem("org.osmf.elements.video",_loc3_.canHandleResource,createVideoElement));
|
||||
_videoElement = _mediaFactory.createMediaElement(_loc2_);
|
||||
_videoElement.addEventListener("traitAdd",onTraitAdd);
|
||||
_captionMetadata = _videoElement.getMetadata("http://www.osmf.org/temporal/captioning") as TimelineMetadata;
|
||||
if(_captionMetadata == null)
|
||||
{
|
||||
_captionMetadata = new TimelineMetadata(_videoElement);
|
||||
_videoElement.addMetadata("http://www.osmf.org/temporal/captioning",_captionMetadata);
|
||||
}
|
||||
_captionMetadata.addEventListener("markerTimeReached",onShowCaption);
|
||||
_captionMetadata.addEventListener("markerAdd",onHideCaption);
|
||||
_videoElement.addEventListener("mediaError",onMediaError,false,0,true);
|
||||
setMediaElement(_videoElement);
|
||||
enablePlayerControls(true);
|
||||
if(!SBAudio.isMusicMuted)
|
||||
{
|
||||
SBAudio.muteMusic(false);
|
||||
_musicMutedByPlayer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_videoPlayer.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function setMediaElement(param1:MediaElement) : void
|
||||
{
|
||||
if(_videoPlayer.media != null && _container.containsMediaElement(_videoPlayer.media))
|
||||
{
|
||||
_container.removeMediaElement(_videoPlayer.media);
|
||||
}
|
||||
if(param1 != null)
|
||||
{
|
||||
_container.addMediaElement(param1);
|
||||
}
|
||||
_videoPlayer.media = param1;
|
||||
}
|
||||
|
||||
private function enablePlayerControls(param1:Boolean = true) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function createVideoElement() : MediaElement
|
||||
{
|
||||
return new VideoElement();
|
||||
}
|
||||
|
||||
private function onTraitAdd(param1:MediaElementEvent) : void
|
||||
{
|
||||
var _loc2_:String = param1.traitType;
|
||||
if("seek" !== _loc2_)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private function onShowCaption(param1:TimelineMetadataEvent) : void
|
||||
{
|
||||
var _loc2_:Caption = param1.marker as Caption;
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
_subTitleTextField.htmlText = _loc2_.text;
|
||||
if(!_graySubtitleBox.visible)
|
||||
{
|
||||
_graySubtitleBox.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onHideCaption(param1:TimelineMetadataEvent) : void
|
||||
{
|
||||
_subTitleTextField.htmlText = "";
|
||||
_graySubtitleBox.visible = false;
|
||||
}
|
||||
|
||||
private function onMediaError(param1:MediaErrorEvent) : void
|
||||
{
|
||||
trace("Media Load Error : " + param1.error.errorID + " - " + param1.error.message);
|
||||
}
|
||||
|
||||
private function formatCaption(param1:Caption) : void
|
||||
{
|
||||
var _loc3_:* = 0;
|
||||
var _loc5_:CaptionFormat = null;
|
||||
var _loc2_:TextFormat = null;
|
||||
var _loc4_:CaptionStyle = null;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < param1.numCaptionFormats)
|
||||
{
|
||||
_loc5_ = param1.getCaptionFormatAt(_loc3_);
|
||||
_loc2_ = new TextFormat();
|
||||
_loc4_ = _loc5_.style;
|
||||
if(_loc4_.textColor != null)
|
||||
{
|
||||
_loc2_.color = _loc4_.textColor;
|
||||
}
|
||||
if(_loc4_.fontFamily != "")
|
||||
{
|
||||
_loc2_.font = _loc4_.fontFamily;
|
||||
}
|
||||
if(_loc4_.fontSize > 0)
|
||||
{
|
||||
_loc2_.size = _loc4_.fontSize;
|
||||
}
|
||||
if(_loc4_.fontStyle != "")
|
||||
{
|
||||
_loc2_.italic = _loc4_.fontStyle == "italic" ? true : false;
|
||||
}
|
||||
if(_loc4_.fontWeight != "")
|
||||
{
|
||||
_loc2_.bold = _loc4_.fontWeight == "bold" ? true : false;
|
||||
}
|
||||
if(_loc4_.textAlign != "")
|
||||
{
|
||||
_loc2_.align = _loc4_.textAlign;
|
||||
}
|
||||
_playerPopup.subtitle.setTextFormat(_loc2_,_loc5_.startIndex,_loc5_.endIndex);
|
||||
if(_playerPopup.subtitle.wordWrap != _loc4_.wrapOption)
|
||||
{
|
||||
_playerPopup.subtitle.wordWrap = _loc4_.wrapOption;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function onSMILPluginLoaded(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
var _loc2_:DynamicStreamingResource = new DynamicStreamingResource("http://wac.6A16.edgecastcdn.net/006A16/IntroVideo/manifest.smil","recorded");
|
||||
_loc2_.urlIncludesFMSApplicationInstance = true;
|
||||
_videoElement = _mediaFactory.createMediaElement(_loc2_);
|
||||
_videoPlayer.media = _videoElement;
|
||||
_videoPlayer.bufferTime = 6;
|
||||
_container.addMediaElement(_videoElement);
|
||||
if(SBAudio.isMusicMuted)
|
||||
{
|
||||
_videoPlayer.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function playLiveStream(param1:int) : void
|
||||
{
|
||||
_FCS = new FCSubscribeHandler();
|
||||
_FCS.run("mba_opensea","rtmp://fml.6A16.edgecastcdn.net/206A16",this);
|
||||
}
|
||||
|
||||
public function fcSubscribeDone() : void
|
||||
{
|
||||
var _loc1_:StreamingURLResource = new StreamingURLResource("rtmp://fml.6A16.edgecastcdn.net/206A16/mba_opensea","live");
|
||||
_videoElement = _mediaFactory.createMediaElement(_loc1_);
|
||||
_videoPlayer.media = _videoElement;
|
||||
_videoPlayer.bufferTime = 6;
|
||||
_container.addMediaElement(_videoElement);
|
||||
if(SBAudio.isMusicMuted)
|
||||
{
|
||||
_videoPlayer.volume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPluginLoadError(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
trace("FAILED TO LOAD PLUGIN");
|
||||
}
|
||||
|
||||
private function completeHandler(param1:TimeEvent) : void
|
||||
{
|
||||
addSpiral();
|
||||
_videoPlayer.stop();
|
||||
_container.removeMediaElement(_videoElement);
|
||||
if(_currVideoIdx < _streamDefs.length - 1)
|
||||
{
|
||||
_currVideoIdx = _currVideoIdx + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currVideoIdx = 0;
|
||||
}
|
||||
_currStreamDef = _streamDefs.getStreamDefItem(_currVideoIdx);
|
||||
if(_shouldRepeatSingleMovie)
|
||||
{
|
||||
playVideoIdx(_currVideoIdx);
|
||||
}
|
||||
else
|
||||
{
|
||||
onClose(null);
|
||||
}
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
DarkenManager.unDarken(_playerPopup);
|
||||
if(_hasMediaId)
|
||||
{
|
||||
SBTracker.pop();
|
||||
}
|
||||
destroy();
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
_closeCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function removeSpiral() : void
|
||||
{
|
||||
if(_hasMediaId)
|
||||
{
|
||||
if(_playerPopup.itemLayer.contains(_loadingSpiral))
|
||||
{
|
||||
_playerPopup.itemLayer.removeChild(_loadingSpiral);
|
||||
}
|
||||
}
|
||||
else if(_theaterWindow.contains(_loadingSpiral))
|
||||
{
|
||||
_theaterWindow.removeChild(_loadingSpiral);
|
||||
}
|
||||
}
|
||||
|
||||
private function addSpiral() : void
|
||||
{
|
||||
if(_hasMediaId)
|
||||
{
|
||||
if(_loadingSpiral && !_playerPopup.itemLayer.contains(_loadingSpiral))
|
||||
{
|
||||
_playerPopup.itemLayer.addChild(_loadingSpiral);
|
||||
}
|
||||
}
|
||||
else if(_loadingSpiral && !_theaterWindow.contains(_loadingSpiral))
|
||||
{
|
||||
_theaterWindow.addChild(_loadingSpiral);
|
||||
}
|
||||
}
|
||||
|
||||
private function mouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user