Ver Mensaje Individual
  #2 (permalink)  
Antiguo 31/08/2012, 07:28
moro666
 
Fecha de Ingreso: mayo-2011
Mensajes: 214
Antigüedad: 12 años, 11 meses
Puntos: 16
Respuesta: Descargar un video dentro de un swf dentro de un <object>???

Código swf:
Ver original
  1. package
  2. {
  3.     import flash.display.*;
  4.     import flash.events.*;
  5.     import flash.external.*;
  6.     import flash.net.*;
  7.     import flash.system.*;
  8.     import flash.utils.*;
  9.  
  10.     public class BrightcoveBootloader extends Sprite
  11.     {
  12.         private var _player:Object;
  13.         private var _playerLoader:Loader;
  14.         private var _flashVars:Object;
  15.         private var _downloadStartTime:int;
  16.         private var _dataDelta:int;
  17.         private const _cookieName:String = "BC_BANDWIDTH";
  18.         private var _cookieContents:Array;
  19.  
  20.         public function BrightcoveBootloader()
  21.         {
  22.             this._flashVars = root.loaderInfo.parameters;
  23.             Security.allowDomain("*");
  24.             this._flashVars.startTime = getTimer();
  25.             var _loc_1:String;
  26.             if (this._flashVars.secureConnections == "true")
  27.             {
  28.                 _loc_1 = "https://sadmin.brightcove.com/viewer/us20120824.1350/";
  29.             }// end if
  30.             if (this._flashVars.isSlim != null)
  31.             {
  32.                 _loc_1 = _loc_1 + "federatedSlim";
  33.             }
  34.             else if (this._flashVars.isVid != null)
  35.             {
  36.                 if (this._flashVars.isUI != null)
  37.                 {
  38.                     _loc_1 = _loc_1 + "federatedVideoUI";
  39.                 }
  40.                 else
  41.                 {
  42.                     _loc_1 = _loc_1 + "federatedVideo";
  43.                 }// end else if
  44.             }
  45.             else if (this._flashVars.isAudio != null)
  46.             {
  47.                 if (this._flashVars.isUI != null)
  48.                 {
  49.                     _loc_1 = _loc_1 + "federatedAudioUI";
  50.                 }
  51.                 else
  52.                 {
  53.                     _loc_1 = _loc_1 + "federatedAudio";
  54.                 }// end else if
  55.             }
  56.             else if (this._flashVars.isUI != null)
  57.             {
  58.                 _loc_1 = _loc_1 + "federatedUI";
  59.             }
  60.             else
  61.             {
  62.                 _loc_1 = _loc_1 + "federated";
  63.             }// end else if
  64.             this._flashVars.cookieComments = [];
  65.             this.initializeUniqueSWFIdentifier();
  66.             this._playerLoader = new Loader();
  67.             this._playerLoader.contentLoaderInfo.addEventListener(Event.INIT, this.onPlayerLoadInit);
  68.             this._playerLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.progressHandler);
  69.             this._playerLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.completeHandler);
  70.             this._playerLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  71.             this._playerLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
  72.             var _loc_2:* = new LoaderContext();
  73.             _loc_2.applicationDomain = ApplicationDomain.currentDomain;
  74.             _loc_2.securityDomain = SecurityDomain.currentDomain;
  75.             var _loc_3:* = this._flashVars.useClientSideBandwidthDetection != "false";
  76.             if (_loc_3)
  77.             {
  78.                 this._playerLoader.load(new URLRequest(_loc_1 + "/BrightcovePlayer.swf?uid=" + this._flashVars.uniqueSWFIdentifier), _loc_2);
  79.             }
  80.             else
  81.             {
  82.                 this._playerLoader.load(new URLRequest(_loc_1 + "/BrightcovePlayer.swf"), _loc_2);
  83.             }// end else if
  84.             return;
  85.         }// end function
  86.  
  87.         private function errorHandler(param1:Event) : void
  88.         {
  89.             this.removeListeners();
  90.             return;
  91.         }// end function
  92.  
  93.         private function progressHandler(param1:ProgressEvent) : void
  94.         {
  95.             if (param1.bytesLoaded > 0)
  96.             {
  97.                 this._dataDelta = param1.bytesTotal - param1.bytesLoaded;
  98.                 this._downloadStartTime = new Date().getTime();
  99.                 param1.target.removeEventListener(ProgressEvent.PROGRESS, this.progressHandler);
  100.             }// end if
  101.             return;
  102.         }// end function
  103.  
  104.         private function completeHandler(param1:Event) : void
  105.         {
  106.             var _loc_2:int;
  107.             this.removeListeners();
  108.             var _loc_3:int;
  109.             if (!this._cookieContents)
  110.             {
  111.                 _loc_2 = new Date().getTime() - this._downloadStartTime;
  112.                 _loc_3 = this._dataDelta / _loc_2 * (8000 / 1024);
  113.                 this._flashVars.bandwidth = _loc_3;
  114.                 this._flashVars.cookieComments.push("Bandwidth calculated from SWF download: " + _loc_3 + " Kbps " + "(time= " + _loc_2 + " ms, size= " + this._dataDelta + " bytes)");
  115.             }// end if
  116.             this._player.initialize(this._flashVars);
  117.             return;
  118.         }// end function