Advertisement
Guest User

Untitled

a guest
Mar 18th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.87 KB | None | 0 0
  1. package seph.media.sephPlayer.models
  2. {
  3. import _-6.*;
  4. import com.wowza.encryptionAS3.*;
  5. import flash.events.*;
  6. import flash.media.*;
  7. import flash.net.*;
  8. import flash.utils.*;
  9. import seph.events.*;
  10. import seph.media.sephPlayer.*;
  11. import seph.media.sephPlayer.events.*;
  12. import seph.media.sephPlayer.utils.*;
  13. import seph.utils.*;
  14.  
  15. public class VideoPlayModel extends seph.media.sephPlayer.models.AbstractPlayModel implements seph.media.sephPlayer.models.IPlayModel
  16. {
  17. public function VideoPlayModel(arg1:seph.media.sephPlayer.SephPlayer, arg2:seph.media.sephPlayer.utils.GUIManager)
  18. {
  19. super(arg1, arg2);
  20. var loc1:*;
  21. var loc2:*=((loc1 = seph.media.sephPlayer.models.VideoPlayModel).NUM_OF_MODEL + 1);
  22. loc1.NUM_OF_MODEL = loc2;
  23. arg2.notice("This is VideoPlayModel number " + seph.media.sephPlayer.models.VideoPlayModel.NUM_OF_MODEL + ". Make sure there is ONLY 1 of this for any time!");
  24. this.createVid(arg1);
  25. this._firstConnect = true;
  26. this.doConnect(arg1.config.streamer, arg1.config.streamerArg, arg1.config.cca);
  27. this._reConnectTimer = new flash.utils.Timer(6000, 1);
  28. this._reConnectTimer.addEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.doReconnect, false, 0, true);
  29. this._bufferEmptyTimer = new flash.utils.Timer(14000, 1);
  30. this._bufferEmptyTimer.addEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.doReconnect, false, 0, true);
  31. return;
  32. }
  33.  
  34. public override function getLoadPerc():Number
  35. {
  36. if (this._ns)
  37. {
  38. return this._ns.bytesLoaded / this._ns.bytesTotal * 100;
  39. }
  40. return 0;
  41. }
  42.  
  43. public override function set mute(arg1:Boolean):void
  44. {
  45. this._mute = arg1;
  46. _player.config.mute = this.mute;
  47. if (!this._ns)
  48. {
  49. return;
  50. }
  51. if (this._mute)
  52. {
  53. this._ns.soundTransform = new flash.media.SoundTransform(0);
  54. }
  55. else
  56. {
  57. this._ns.soundTransform = new flash.media.SoundTransform(1);
  58. }
  59. return;
  60. }
  61.  
  62. public override function getStreamInfo():Object
  63. {
  64. if (this._ns)
  65. {
  66. return this._ns.info;
  67. }
  68. return null;
  69. }
  70.  
  71. public override function dispose():Boolean
  72. {
  73. var loc1:*;
  74. if (this._ns)
  75. {
  76. this._ns.removeEventListener(flash.events.NetStatusEvent.NET_STATUS, this.onNetStatusHandler);
  77. this._ns.pause();
  78. this._ns.close();
  79. if (this._ns.client && this._ns.client is seph.media.sephPlayer.utils.NetStatusClient)
  80. {
  81. this._ns.client.dispose();
  82. }
  83. this._ns.client = {};
  84. this._ns = null;
  85. }
  86. this.disposeVid();
  87. if (this._nc)
  88. {
  89. try
  90. {
  91. this._nc.close();
  92. }
  93. catch (e:Error)
  94. {
  95. seph.utils.Traceable.doTrace(this + ": Error while trying to close NetConnection.", "error");
  96. }
  97. this._nc.removeEventListener(flash.events.NetStatusEvent.NET_STATUS, this.onNetStatusHandler);
  98. if (this._nc.client)
  99. {
  100. this._nc.client = {};
  101. }
  102. this._nc = null;
  103. }
  104. if (this._bwcheckTimer)
  105. {
  106. this._bwcheckTimer.stop();
  107. this._bwcheckTimer.removeEventListener(flash.events.TimerEvent.TIMER, this.onBWCheckTimerHandler);
  108. this._bwcheckTimer = null;
  109. }
  110. if (this._reConnectTimer)
  111. {
  112. this._reConnectTimer.stop();
  113. this._reConnectTimer.removeEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.doReconnect);
  114. this._reConnectTimer = null;
  115. }
  116. if (this._bufferEmptyTimer)
  117. {
  118. this._bufferEmptyTimer.stop();
  119. this._bufferEmptyTimer.removeEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.doReconnect);
  120. this._bufferEmptyTimer = null;
  121. }
  122. return super.dispose();
  123. }
  124.  
  125. protected function disposeVid():void
  126. {
  127. if (this._vid)
  128. {
  129. this._vid.clear();
  130. if (this._vid.parent)
  131. {
  132. this._vid.parent.removeChild(this._vid);
  133. }
  134. this._vid = null;
  135. }
  136. return;
  137. }
  138.  
  139. public function onBwCheck(arg1:*):void
  140. {
  141. return;
  142. }
  143.  
  144. public override function pause():void
  145. {
  146. super.pause();
  147. if (this._ns)
  148. {
  149. this._pausePosition = this.time;
  150. this._ns.pause();
  151. }
  152. return;
  153. }
  154.  
  155. public function onBWCheck(arg1:*):void
  156. {
  157. return;
  158. }
  159.  
  160. public function close():void
  161. {
  162. seph.utils.Traceable.doTrace(this + ": NetConnection closed by server.");
  163. return;
  164. }
  165.  
  166. protected function onBWCheckTimerHandler(arg1:flash.events.TimerEvent):void
  167. {
  168. if (!this._isPausing)
  169. {
  170. this.doCheckBW();
  171. }
  172. return;
  173. }
  174.  
  175. public function get isPlayFinalCompleteDispatched():Boolean
  176. {
  177. return this._isPlayFinalCompleteDispatched;
  178. }
  179.  
  180. protected function doCheckBW():void
  181. {
  182. var loc1:*;
  183. try
  184. {
  185. this._nc.call("checkBandwidth", null);
  186. }
  187. catch (e:Error)
  188. {
  189. seph.utils.Traceable.doTrace(this + ": Error calling \"checkBandwidth\" on server.", "error");
  190. }
  191. return;
  192. }
  193.  
  194. public function get isPlayTransitioning():Boolean
  195. {
  196. return this._isPlayTransitioning;
  197. }
  198.  
  199. public override function getApplicationConnectionCount(arg1:flash.events.Event=null):void
  200. {
  201. if (this._nc)
  202. {
  203. this._nc.call("getApplicationConnectionCount", this._appConnCountResponder);
  204. }
  205. return;
  206. }
  207.  
  208. protected override function onAppConnCountResHandler(arg1:Number):void
  209. {
  210. _player.evtMngr.dispatchEvent(new seph.events.ItemEvent(seph.media.sephPlayer.events.SephPlayerEvent.CONNECTED_USERS_COUNT_RESULT, arg1));
  211. return;
  212. }
  213.  
  214. public function get isRTMP():Boolean
  215. {
  216. return this._isRTMP;
  217. }
  218.  
  219.  
  220. {
  221. NUM_OF_MODEL = 0;
  222. }
  223.  
  224. public override function get display():*
  225. {
  226. return this._vid;
  227. }
  228.  
  229. protected function createVid(arg1:seph.media.sephPlayer.SephPlayer):void
  230. {
  231. this._vid = new flash.media.Video(4, 3);
  232. this._vid.smoothing = arg1.config.smoothing;
  233. if (arg1.numChildren == 0)
  234. {
  235. arg1.addChild(this._vid);
  236. }
  237. else
  238. {
  239. arg1.addChildAt(this._vid, 1);
  240. }
  241. this._vid.visible = false;
  242. this._vid.x = arg1.width / 2 - this._vid.width / 2;
  243. this._vid.y = arg1.height / 2 - this._vid.height / 2;
  244. return;
  245. }
  246.  
  247. public function exploreVideoDecodingCapability():void
  248. {
  249. var loc1:*=_player.root.loaderInfo.parameters["wmode"];
  250. }
  251.  
  252. protected function handleHardwareAccelerationCapability(arg1:*):void
  253. {
  254. var loc1:*=String(arg1);
  255. }
  256.  
  257. public override function get time():Number
  258. {
  259. this._time = this._ns ? this._ns.time : 0;
  260. return this._time;
  261. }
  262.  
  263. public override function doConnect(arg1:String=null, arg2:String=null, arg3:String=null):void
  264. {
  265. seph.utils.Traceable.doTrace(this + ": VideoPlayModel is making a connection...", "info");
  266. _guiMngr.notice(seph.media.sephPlayer.SephPlayer.LANG.CONNECTING, true);
  267. if (!this._nc)
  268. {
  269. this._nc = new flash.net.NetConnection();
  270. this._nc.addEventListener(flash.events.NetStatusEvent.NET_STATUS, this.onNetStatusHandler, false, 0, true);
  271. this._nc.client = this;
  272. }
  273. this._nc.connect(arg1, arg2, arg3);
  274. return;
  275. }
  276.  
  277. protected function doReconnect(arg1:flash.events.TimerEvent=null):void
  278. {
  279. if (this._nc)
  280. {
  281. this._nc.removeEventListener(flash.events.NetStatusEvent.NET_STATUS, this.onNetStatusHandler);
  282. this._nc.client = {};
  283. }
  284. this._nc = new flash.net.NetConnection();
  285. this._nc.addEventListener(flash.events.NetStatusEvent.NET_STATUS, this.onNetStatusHandler, false, 0, true);
  286. this._nc.client = this;
  287. this._nc.connect(_player.config.streamer, _player.config.streamerArg);
  288. return;
  289. }
  290.  
  291. private function streamingStatusHandler(arg1:flash.events.NetStatusEvent):void
  292. {
  293. var loc4:*=null;
  294. var loc5:*=null;
  295. var loc6:*=null;
  296. var loc1:*=String(arg1.info.code);
  297. var loc2:*=arg1.info.details;
  298. var loc3:*=arg1.info.description;
  299. _guiMngr.streamingStatusHandler(arg1);
  300. var loc7:*=loc1;
  301. switch (loc7)
  302. {
  303. case "NetConnection.Connect.Success":
  304. {
  305. if (this._firstConnect)
  306. {
  307. this._firstConnect = false;
  308. this.play();
  309. }
  310. else if (this._ns && seph.media.sephPlayer.utils.SephPlayerUtils.isFlash10Point1() && seph.media.sephPlayer.SephPlayerGlobal.SERVER_TYPE == "fms")
  311. {
  312. (loc7 = this._ns)["attach"](this._nc);
  313. (loc4 = new flash.net.NetStreamPlayOptions()).transition = flash.net.NetStreamPlayTransitions["RESUME"];
  314. loc4.streamName = _player.config.file;
  315. loc4.start = 0;
  316. loc4.len = -1;
  317. this._ns.play2(loc4);
  318. }
  319. else
  320. {
  321. (loc5 = _player.playlistMngr.getCurrentClip()).start = this._pausePosition;
  322. _player.playFile(loc5);
  323. }
  324. break;
  325. }
  326. case "NetConnection.Connect.Closed":
  327. {
  328. this._pausePosition = this.time;
  329. if (this._isRTMP && this._ns && !this._isPlayFinalCompleteDispatched)
  330. {
  331. this._reConnectTimer.start();
  332. }
  333. break;
  334. }
  335. case "NetConnection.Connect.Rejected":
  336. {
  337. loc6 = String(loc3);
  338. loc7 = seph.media.sephPlayer.SephPlayerGlobal.SERVER_TYPE;
  339. switch (loc7)
  340. {
  341. case "wowza":
  342. {
  343. loc6 = arg1.info.application;
  344. break;
  345. }
  346. }
  347. this._player.evtMngr.dispatchEvent(new seph.events.ItemEvent(seph.media.sephPlayer.events.SephPlayerEvent.NETCONNECTION_CONNECT_REJECTED, loc6));
  348. break;
  349. }
  350. case "NetConnection.Connect.Failed":
  351. {
  352. this._player.evtMngr.dispatchEvent(new flash.events.Event(seph.media.sephPlayer.events.SephPlayerEvent.NETCONNECTION_CONNECT_FAILED));
  353. if (this._isRTMP)
  354. {
  355. this._reConnectTimer.start();
  356. }
  357. break;
  358. }
  359. case "NetStream.Play.Complete":
  360. {
  361. this.onPlayFinalComplete();
  362. break;
  363. }
  364. case "NetStream.Play.Start":
  365. {
  366. this.onPlayStart();
  367. break;
  368. }
  369. case "NetStream.Play.StreamNotFound":
  370. {
  371. this._player.evtMngr.dispatchEvent(new flash.events.Event(seph.media.sephPlayer.events.SephPlayerEvent.STREAM_NOT_FOUND));
  372. break;
  373. }
  374. case "NetStream.Play.Transition":
  375. {
  376. this._isPlayTransitioning = true;
  377. break;
  378. }
  379. case "NetStream.Play.TransitionComplete":
  380. {
  381. this._isPlayTransitioning = false;
  382. break;
  383. }
  384. case "NetStream.Play.InsufficientBW":
  385. {
  386. break;
  387. }
  388. case "NetStream.Seek.Notify":
  389. {
  390. if (this._isPlaying)
  391. {
  392. if (arg1.info.description && String(arg1.info.description).indexOf("client-inBufferSeek") >= 0)
  393. {
  394. _guiMngr.notice("smart seek");
  395. }
  396. else
  397. {
  398. _guiMngr.notice("standard seek");
  399. }
  400. }
  401. else
  402. {
  403. this.onPlayStart();
  404. _guiMngr.streamingStatusHandler("NetStream.Play.Start");
  405. if (_timer && !_timer.running)
  406. {
  407. _timer.start();
  408. }
  409. }
  410. break;
  411. }
  412. case "NetStream.Seek.InvalidTime":
  413. {
  414. if (loc2 && !isNaN(Number(loc2)) && this._ns)
  415. {
  416. this._ns.seek(Number(loc2));
  417. }
  418. break;
  419. }
  420. case "NetStream.Pause.Notify":
  421. {
  422. break;
  423. }
  424. case "NetStream.Play.Stop":
  425. {
  426. seph.utils.Traceable.doTrace(this + ": Play.Stop dispatched.", "info");
  427. this._isNetStreamPlayStopDispatched = true;
  428. if (!this._isRTMP)
  429. {
  430. this.onPlayFinalComplete();
  431. }
  432. break;
  433. }
  434. case "NetStream.Buffer.Full":
  435. {
  436. if (!this._isNetStreamPlayStartDispatched)
  437. {
  438. seph.utils.Traceable.doTrace("NetStream.Play.Start wasn\'t dispatched. This message should appear once per item played.\nPlayer config: " + _player.getConfig(), "info");
  439. this.onPlayStart();
  440. }
  441. this._bufferEmptyTimer.stop();
  442. this._bufferEmptyTimer.reset();
  443. break;
  444. }
  445. case "NetStream.Buffer.Empty":
  446. {
  447. if (this._ns)
  448. {
  449. if (this._isNetStreamPlayStopDispatched || !isNaN(this.time) && this.time > 0 && this.time >= _player.metadata.duration - 0.3)
  450. {
  451. this.onPlayFinalComplete();
  452. }
  453. }
  454. this._pausePosition = this.time;
  455. if (this.isRTMP && !this._bufferEmptyTimer.running && this._isPlaying)
  456. {
  457. this._bufferEmptyTimer.start();
  458. }
  459. break;
  460. }
  461. }
  462. return;
  463. }
  464.  
  465. public function onNetStatusHandler(arg1:flash.events.NetStatusEvent):void
  466. {
  467. seph.utils.Traceable.doTrace("NetStatus dispatched from " + arg1.currentTarget + ": ", "info");
  468. seph.utils.Traceable.doTrace("\t" + arg1.info.code, "info");
  469. if (seph.media.sephPlayer.SephPlayerGlobal.SERVER_TYPE == "wowza")
  470. {
  471. if (arg1.info.secureToken != null)
  472. {
  473. this._nc.call(_-6._-3._-0(-688, 458), null, com.wowza.encryptionAS3.TEA.decrypt(arg1.info.secureToken, _-6._-3._-0(-689, 457)));
  474. }
  475. }
  476. this.streamingStatusHandler(arg1);
  477. return;
  478. }
  479.  
  480. public override function play(arg1:String=null, arg2:Number=0):void
  481. {
  482. _player.stage.dispatchEvent(new flash.events.Event(flash.events.Event.RESIZE));
  483. if (this._ns)
  484. {
  485. this._ns.removeEventListener(flash.events.NetStatusEvent.NET_STATUS, this.onNetStatusHandler);
  486. if (this._ns.client && this._ns.client is seph.media.sephPlayer.utils.NetStatusClient)
  487. {
  488. this._ns.client.dispose();
  489. }
  490. this._ns.client = {};
  491. this._ns.pause();
  492. this._ns.close();
  493. this._vid.clear();
  494. this._vid.attachCamera(null);
  495. this._ns = null;
  496. }
  497. if (!this._nc || !this._nc.connected)
  498. {
  499. seph.utils.Traceable.doTrace(this + ": NetConnection isn\'t connected yet!", "error");
  500. }
  501. else
  502. {
  503. this._ns = new flash.net.NetStream(this._nc);
  504. this._ns.addEventListener(flash.events.NetStatusEvent.NET_STATUS, this.onNetStatusHandler, false, 0, true);
  505. this._ns.bufferTime = _player.config.live ? 0.25 : 3;
  506. this._ns.client = new seph.media.sephPlayer.utils.NetStatusClient(_player);
  507. this._vid.attachNetStream(this._ns);
  508. this.mute = _player.config.mute;
  509. this._ns.play(arg1 ? arg1 : _player.config.file);
  510. if (_player.config.streamer)
  511. {
  512. this._isRTMP = true;
  513. this._ns.bufferTime = 5;
  514. }
  515. else
  516. {
  517. this._isRTMP = false;
  518. }
  519. }
  520. return;
  521. }
  522.  
  523. public override function switchToStreamName(arg1:String):void
  524. {
  525. if (!this._ns || !arg1)
  526. {
  527. seph.utils.Traceable.doTrace(this + ": Unable to switchToStreamName. There\'s either no NetStream or any bitrate name specified.");
  528. return;
  529. }
  530. var loc1:*=new flash.net.NetStreamPlayOptions();
  531. loc1.oldStreamName = this._player.config.file;
  532. loc1.streamName = arg1;
  533. loc1.transition = flash.net.NetStreamPlayTransitions.SWITCH;
  534. this._ns.play2(loc1);
  535. this._player.config.file = arg1;
  536. return;
  537. }
  538.  
  539. public function setTitle():String
  540. {
  541. return "media";
  542. }
  543.  
  544. public override function togglePause():void
  545. {
  546. super.togglePause();
  547. if (this._ns)
  548. {
  549. this._pausePosition = this.time;
  550. this._ns.togglePause();
  551. }
  552. return;
  553. }
  554.  
  555. public override function resume():void
  556. {
  557. super.resume();
  558. if (this._ns)
  559. {
  560. this._ns.resume();
  561. }
  562. return;
  563. }
  564.  
  565. public override function stop():void
  566. {
  567. if (this._isPlaying)
  568. {
  569. this.pause();
  570. }
  571. return;
  572. }
  573.  
  574. public override function seek(arg1:Number):void
  575. {
  576. if (!isNaN(arg1) && !(arg1 == 0) && this._ns)
  577. {
  578. this._ns.seek(arg1);
  579. }
  580. return;
  581. }
  582.  
  583. protected override function onPlayStart():void
  584. {
  585. if (!_isPlaying)
  586. {
  587. this._isPlaying = true;
  588. if (this._ns.time <= 0.5)
  589. {
  590. if (this._vid)
  591. {
  592. this._vid.visible = true;
  593. }
  594. if (_timer)
  595. {
  596. _timer.reset();
  597. }
  598. else
  599. {
  600. _timer = new flash.utils.Timer(50);
  601. _timer.addEventListener(flash.events.TimerEvent.TIMER, this.onTimerHandler, false, 0, true);
  602. }
  603. _timer.start();
  604. this.onPlayFirstStart();
  605. this._isPlayFinalCompleteDispatched = false;
  606. }
  607. super.onPlayStart();
  608. this._isNetStreamPlayStopDispatched = false;
  609. this._isNetStreamPlayStartDispatched = true;
  610. }
  611. return;
  612. }
  613.  
  614. protected override function onPlayFirstStart():void
  615. {
  616. if (_player.config.live)
  617. {
  618. this.getApplicationConnectionCount();
  619. if (this._appConnCountTimer)
  620. {
  621. this._appConnCountTimer.reset();
  622. this._appConnCountTimer.start();
  623. }
  624. else
  625. {
  626. this._appConnCountTimer = new flash.utils.Timer(30000);
  627. this._appConnCountTimer.addEventListener(flash.events.TimerEvent.TIMER, this.getApplicationConnectionCount, false, 0, true);
  628. this._appConnCountTimer.start();
  629. }
  630. }
  631. if (_player.config.start > 0)
  632. {
  633. this._guiMngr.updateRightTF(seph.media.sephPlayer.utils.SephPlayerUtils.convertFromSecToMin(_player.metadata.duration));
  634. this._player.stage.dispatchEvent(new flash.events.Event(flash.events.Event.RESIZE));
  635. this.seek(_player.config.start);
  636. }
  637. super.onPlayFirstStart();
  638. return;
  639. }
  640.  
  641. protected override function onPlayFinalComplete():void
  642. {
  643. if (this._isPlayFinalCompleteDispatched)
  644. {
  645. return;
  646. }
  647. this._isPlayFinalCompleteDispatched = true;
  648. if (_isPlaying)
  649. {
  650. _isPlaying = false;
  651. this._isNetStreamPlayStopDispatched = true;
  652. this._isNetStreamPlayStartDispatched = false;
  653. if (_timer)
  654. {
  655. _timer.stop();
  656. }
  657. if (this._vid)
  658. {
  659. this._vid.clear();
  660. this._vid.attachNetStream(null);
  661. }
  662. if (!this._firstConnect && !_player.isInInStreamSession)
  663. {
  664. _player.playlistMngr.getCurrentClip().start = 0;
  665. _player.config.start = 0;
  666. }
  667. _player.guiMngr.notice(seph.media.sephPlayer.SephPlayer.LANG.PLAYBACK_END);
  668. super.onPlayFinalComplete();
  669. }
  670. return;
  671. }
  672.  
  673. protected override function onPlayComplete():void
  674. {
  675. seph.utils.Traceable.doTrace(this + ": Play.Complete dispatched", "info");
  676. this._isNetStreamPlayStopDispatched = true;
  677. this._isNetStreamPlayStartDispatched = false;
  678. super.onPlayComplete();
  679. return;
  680. }
  681.  
  682. public override function onPlayStatus(arg1:*):void
  683. {
  684. if (arg1["id"] && arg1["id"]["code"])
  685. {
  686. _guiMngr.streamingStatusHandler(String(arg1["id"]["code"]));
  687. var loc1:*=String(arg1["id"]["code"]);
  688. switch (loc1)
  689. {
  690. case "NetStream.Play.Complete":
  691. {
  692. this.onPlayFinalComplete();
  693. break;
  694. }
  695. }
  696. }
  697. return;
  698. }
  699.  
  700. public override function onMetadataReceived(arg1:flash.events.Event):void
  701. {
  702. _guiMngr.updateRightTF(seph.media.sephPlayer.utils.SephPlayerUtils.convertFromSecToMin(_player.metadata.duration));
  703. super.onMetadataReceived(arg1);
  704. this.exploreVideoDecodingCapability();
  705. seph.utils.Traceable.doTrace(this + ": Metadata received.", "info");
  706. return;
  707. }
  708.  
  709. public function onBWDone(arg1:Number=NaN, arg2:Number=NaN, arg3:Number=NaN, arg4:Number=NaN):void
  710. {
  711. var loc1:*=0;
  712. seph.utils.Traceable.doTrace("onBWDone: kbitDown:" + arg1 + " deltaDown:" + arg2 + " deltaTime:" + arg3 + " latency:" + arg4);
  713. if (!isNaN(arg1))
  714. {
  715. _player.usrDetailsMngr.bandwidth = arg1;
  716. if (!this._isPlayTransitioning && this._player.playlistMngr.getCurrentClip().streams && this._player.playlistMngr.getCurrentClip().streams.length > 1)
  717. {
  718. if (arg1 < seph.media.sephPlayer.SephPlayerGlobal.BITRATE_THRESHOLD_SIMPLE)
  719. {
  720. _player.guiMngr.receiveGUIEvent(seph.media.sephPlayer.events.SephPlayerEvent.BITRATE_GUI_CHANGE_REQUEST, 1);
  721. }
  722. else
  723. {
  724. loc1 = this._player.playlistMngr.getCurrentClip().streams.length;
  725. _player.guiMngr.receiveGUIEvent(seph.media.sephPlayer.events.SephPlayerEvent.BITRATE_GUI_CHANGE_REQUEST, loc1);
  726. }
  727. }
  728. }
  729. this._player.evtMngr.dispatchEvent(new seph.events.ItemEvent(seph.media.sephPlayer.events.SephPlayerEvent.BANDWIDTH_DETECTED, arg1));
  730. if (this._bwcheckTimer)
  731. {
  732. this._bwcheckTimer.reset();
  733. this._bwcheckTimer.start();
  734. }
  735. else if (this._player.config.allowBWCheck)
  736. {
  737. this._bwcheckTimer = new flash.utils.Timer(300000, 1);
  738. this._bwcheckTimer.addEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.onBWCheckTimerHandler, false, 0, true);
  739. this.doCheckBW();
  740. }
  741. return;
  742. }
  743.  
  744. public override function onTimerHandler(arg1:flash.events.TimerEvent):void
  745. {
  746. var loc1:*=this.getProgPerc();
  747. var loc2:*=this.getLoadPerc();
  748. _guiMngr.updateBar(loc1, loc2);
  749. _guiMngr.updateLeftTF(seph.media.sephPlayer.utils.SephPlayerUtils.convertFromSecToMin(this.time));
  750. this._player.evtMngr.onPlayTimeUpdatedHandler(new seph.events.ItemEvent(seph.media.sephPlayer.events.SephPlayerEvent.PLAY_TIME_UPDATED, this.time));
  751. return;
  752. }
  753.  
  754. public override function getProgPerc():Number
  755. {
  756. if (this._ns)
  757. {
  758. return isNaN(_player.metadata.duration) ? 0 : this.time / Number(_player.metadata.duration) * 100;
  759. }
  760. return 0;
  761. }
  762.  
  763. protected var _firstConnect:Boolean=true;
  764.  
  765. protected var _reConnectTimer:flash.utils.Timer;
  766.  
  767. protected var _bufferEmptyTimer:flash.utils.Timer;
  768.  
  769. protected var stageVideoUsed:Boolean=false;
  770.  
  771. protected var _nc:flash.net.NetConnection;
  772.  
  773. protected var _ns:flash.net.NetStream;
  774.  
  775. protected var _isNetStreamPlayStopDispatched:Boolean=false;
  776.  
  777. protected var _isNetStreamPlayStartDispatched:Boolean=false;
  778.  
  779. protected var _isPlayFinalCompleteDispatched:Boolean=false;
  780.  
  781. protected var _isPlayTransitioning:Boolean=false;
  782.  
  783. protected var _bwcheckTimer:flash.utils.Timer;
  784.  
  785. protected var _isRTMP:Boolean=false;
  786.  
  787. protected var _playCompleteTimer:flash.utils.Timer;
  788.  
  789. public static var NUM_OF_MODEL:Number=0;
  790.  
  791. protected var _vid:flash.media.Video;
  792. }
  793. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement