Author: ygrego Date: 2015-02-12 11:09:34 +0000 (Thu, 12 Feb 2015) New Revision: 793 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/793 Log: Addition of handling error in method 'VideoBroadcastObject.bindToCurrentChannel'. Modified: oipf/js/impl/VideoBroadcastObject.js Modified: oipf/js/impl/VideoBroadcastObject.js =================================================================== --- oipf/js/impl/VideoBroadcastObject.js 2015-02-11 17:01:49 UTC (rev 792) +++ oipf/js/impl/VideoBroadcastObject.js 2015-02-12 11:09:34 UTC (rev 793) @@ -299,16 +299,28 @@ switch(this.playstate){ - case 0: - if (currentChannel) { - this.currentChannel = currentChan; - this.onPlayStateChange && this.onPlayStateChange(2); - return this.currentChannel; - } else { - this.onPlayStateChange && this.onPlayStateChange(0, 100); - } - break; + case 0: + try{ + //claimed scarce resources + //Call method to claim scarces resources + + if (currentChan) { + + this.currentChannel = currentChan; + + } else { + + throw new Error(); + } + this.onPlayStateChange && this.onPlayStateChange(2); + + } catch (e) { + + this.onPlayStateChange && this.onPlayStateChange(0, 100); + } + break; + case 1: break; @@ -316,10 +328,13 @@ break; case 3: + + this.onPlayStateChange && this.onPlayStateChange(1); + break; - } + return this.currentChannel; }, /*