/**
* @param _url
*/
public function getVideoUrl(url:String):void
{
this.loader = new URLLoader;
this.loader.addEventListener(Event.COMPLETE, this.getVideoUrlComplite);
this.loader.load(new URLRequest(url));
}
/**
*
* @param e
*/
private function getVideoUrlComplite(e:Event):void
{
var page:String = e.target.data;
var finder:RegExp = /name=\"flashvars\"\s+value=\"(?P<flashvars>.*)\"/gi
var result:Array = finder.exec(page);
page = null;
var flashvars:String = (result.flashvars || "").replace(/\&\;/gi, '&');
var varUrl:URLVariables = new URLVariables(flashvars);
this._url = varUrl.url360;
// url240
// url360
// url480
// url720
this._ready = true;
this.ns.play(this._url);
this.loader.removeEventListener(Event.COMPLETE, this.getVideoUrlComplite);
}
function getTime(msec, useString) {
var nSec = Math.floor(msec/1000),
hh = Math.floor(nSec/3600),
min = Math.floor(nSec/60) - Math.floor(hh * 60),
sec = Math.floor(nSec -(hh*3600) -(min*60));
return (useString ? ((hh ? hh + ':' : '') + (hh && min < 10 ? '0' + min : min) + ':' + ( sec < 10 ? '0' + sec : sec ) ) : { 'min': min, 'sec': sec });
}
/**
* @var null
*/
private static $_auth_token = null;
/**
* @var API|null
*/
private $_api = null;
/**
* @var null
*/
private static $_config = null;
/**
*
*/
public function __construct()
{
static::$_config = []; // конфиг
set_time_limit(600);
if (static::$_auth_token == null)
{
static::getAuthToken();
}
$this->_api = new API(static::$_auth_token);
}
/**
* @throws APIExcepton
* @return string
*/
private static function getAuthToken()
{
$api = new API();
$config = static::$_config;
$response = $api->authorizeByPassword($config['client_id'], $config['client_secret'], $config['default_scopes'], $config['username'], $config['password']);
$result = $response->getResult();
return static::$_auth_token = $result->access_token;
}
$this->_api->get($query_string, [
'limit' => 10000,
'offset' => 0
])->getArrayResult();