Author: ygrego Date: 2015-07-10 18:39:00 +0200 (Fri, 10 Jul 2015) New Revision: 1803 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1803 Log: Refactoring global for display of programme information and channel switching. Modified: oipf/emulator/js/contollers/PanelChannelController.js oipf/emulator/js/contollers/RemoteControlController.js oipf/emulator/js/contollers/VideoBroadcastController.js oipf/emulator/js/emulator.js oipf/emulator/js/services/SearchManagerService.js oipf/emulator/js/services/VideoBroadcastService.js oipf/emulator/view/index.html Modified: oipf/emulator/js/contollers/PanelChannelController.js =================================================================== --- oipf/emulator/js/contollers/PanelChannelController.js 2015-07-10 16:37:55 UTC (rev 1802) +++ oipf/emulator/js/contollers/PanelChannelController.js 2015-07-10 16:39:00 UTC (rev 1803) @@ -9,7 +9,9 @@ $scope.startTime; $scope.stopTime; $scope.genres; - $scope.parentalControl; + $scope.duration; + $scope.parentalRating = -10; + $scope.newWidth = "{'width':'50px'}"; $scope.chanLogo = ""; @@ -21,6 +23,10 @@ $scope.chanLogo = $scope.videoBroadcastService.getCurrentChannelLogoUrl(); $scope.programmeTitle = $scope.searchManagerService.getCurrentProgrammeName(); $scope.genres = $scope.searchManagerService.getCurrentProgrammeGenre(); + $scope.startTime = $scope.searchManagerService.getCurrentProgrammeStartTime() * 1000; + $scope.duration = $scope.searchManagerService.getCurrentProgrammeDuration() * 1000; + $scope.stopTime = $scope.duration + $scope.startTime; + $scope.newWidth = "{'width':'70px'}"; $scope.isRequired = true; } else if (!newInfo) { Modified: oipf/emulator/js/contollers/RemoteControlController.js =================================================================== --- oipf/emulator/js/contollers/RemoteControlController.js 2015-07-10 16:37:55 UTC (rev 1802) +++ oipf/emulator/js/contollers/RemoteControlController.js 2015-07-10 16:39:00 UTC (rev 1803) @@ -36,6 +36,9 @@ $scope.$broadcast("VolumeEvent", changeType); }; + $scope.setChannelByNumber = function(number) { + }; + $scope.clickMapping = { POWER: "setPowerChange", 0: "setChannelByNumber", Modified: oipf/emulator/js/contollers/VideoBroadcastController.js =================================================================== --- oipf/emulator/js/contollers/VideoBroadcastController.js 2015-07-10 16:37:55 UTC (rev 1802) +++ oipf/emulator/js/contollers/VideoBroadcastController.js 2015-07-10 16:39:00 UTC (rev 1803) @@ -7,13 +7,13 @@ $scope.configurationService = ConfigurationService; $scope.chanLogo = ""; - + $scope.displayLogo = true; $scope.promiseVolumeView = null; $scope.volumeClass = "glyphicon-volume-down"; $scope.currentVolume = $scope.configurationService.configurationObject.localSystem.volume; $rootScope.channelInfo = false; - $scope.volumeViewActive = true; + $scope.volumeViewActive = false; $scope.setChannelByNumber = function(buttonId) { $scope.channelNumberActive = true; @@ -30,7 +30,23 @@ $scope.$on("ChannelChangeEvent", function(event, changeType) { console.log(changeType); - }); + $scope.videoBroadcastService.changeChannel(changeType) + .then(function() { + console.log($scope.videoBroadcastService.getCurrentChannel().name); + }) + .then(function() { + return $scope.searchManagerService + .findCurrentProgramme($scope.videoBroadcastService.getCurrentChannel()); + }) + .then(function() { + $rootScope.channelInfo = false; + $timeout(function() { + $scope.chanLogo = $scope.videoBroadcastService.getCurrentChannelLogoUrl(); + $scope.displayLogo = true; + $rootScope.channelInfo = true; + }, 1000); + }); + }); $scope.$on("VolumeEvent", function(event, changeType) { console.log("A VolumeEvent has been received: The volume will change."); @@ -77,9 +93,10 @@ .then(function() { console.log("Current programme OK."); $rootScope.channelInfo = true; + $scope.displayLogo = true; console.groupEnd("VideoBroadcastController"); $timeout(function() { - $rootScope.channelInfo = false; +// $rootScope.channelInfo = false; }, 4000); }); } else { @@ -86,6 +103,9 @@ var promise = $scope.videoBroadcastService.release.call($scope.videoBroadcastService); promise.then(function() { console.group("VideoBroadcastController"); + $scope.chanLogo = ""; + $rootScope.channelInfo = false; + $scope.displayLogo = false; console.log("The video-broadcast object have been released, SYSTEM OFF.") console.groupEnd("VideoBroadcastController"); }); Modified: oipf/emulator/js/emulator.js =================================================================== --- oipf/emulator/js/emulator.js 2015-07-10 16:37:55 UTC (rev 1802) +++ oipf/emulator/js/emulator.js 2015-07-10 16:39:00 UTC (rev 1803) @@ -4,11 +4,13 @@ var OIPFServices = angular.module("OIPFServices", []); var Controllers = angular.module("Controllers", []); var Filters = angular.module("Filters", []); +var Directives = angular.module("Directives", []); var emulatorApplication = angular.module("emulatorApplication", [ "OIPFServices", "Controllers", - "Filters" + "Filters", + "Directives" ]); Modified: oipf/emulator/js/services/SearchManagerService.js =================================================================== --- oipf/emulator/js/services/SearchManagerService.js 2015-07-10 16:37:55 UTC (rev 1802) +++ oipf/emulator/js/services/SearchManagerService.js 2015-07-10 16:39:00 UTC (rev 1803) @@ -20,6 +20,14 @@ return this.currentProgramme.genre || ["Unknow"]; }; + searchManagerService.getCurrentProgrammeStartTime = function() { + return this.currentProgramme.startTime || "Unkonw"; + }; + + searchManagerService.getCurrentProgrammeDuration = function() { + return this.currentProgramme.duration || "Unkonw"; + }; + searchManagerObject.onMetadataSearch = function(resolve, reject, search, state) { console.log("[INFO]: onMetadataSearch called"); Modified: oipf/emulator/js/services/VideoBroadcastService.js =================================================================== --- oipf/emulator/js/services/VideoBroadcastService.js 2015-07-10 16:37:55 UTC (rev 1802) +++ oipf/emulator/js/services/VideoBroadcastService.js 2015-07-10 16:39:00 UTC (rev 1803) @@ -18,7 +18,7 @@ }; videoBroadcastService.getCurrentChannelLogoUrl = function() { - return this.getCurrentChannel().logoUrl; + return this.getCurrentChannel().logoURL; }; videoBroadcastService.bindToCurrentChannel = function() { @@ -27,6 +27,7 @@ this.previousState = this.videoBroadcastObject.playState; this.currentIndex = 0; + this.resetTransition(); this.videoBroadcastObject.onPlayStateChange = function(state, error) { if (state == videoBroadcastConstants.state.PRESENTING) { @@ -52,6 +53,7 @@ var deferred = $q.defer(); if (this.videoBroadcastObject.playState) { + this.resetTransition(); this.currentIndex = 0; this.previousState = this.videoBroadcastObject.playState; @@ -69,8 +71,8 @@ return deferred.promise; }; - videoBroadcastService.prevChannel = function() { - + videoBroadcastService.changeChannel = function(changeType) { + this.resetTransition(); var deferred = $q.defer(); this.currentIndex = 0; @@ -86,36 +88,17 @@ deferred.resolve(); }; - this.videoBroadcastObject.prevChannel && this.videoBroadcastObject.prevChannel(); + if (changeType == "P+") { + this.videoBroadcastObject.nextChannel && this.videoBroadcastObject.prevChannel(); + } else if (changeType == "P-") { + this.videoBroadcastObject.prevChannel && this.videoBroadcastObject.nextChannel(); + } + return deferred.promise; - } - videoBroadcastService.nextChannel = function() { + }; - var deferred = $q.defer(); - this.currentIndex = 0; - - this.videoBroadcastObject.onPlayStateChange = - this.onChangeState.bind(this, deferred.resolve, deferred.reject); - - this.previousState = this.videoBroadcastObject.playState; - - this.addTransition(this.previousState, - videoBroadcastConstants.state.CONNECTING); - - this.addTransition(videoBroadcastConstants.state.CONNECTING, - videoBroadcastConstants.state.PRESENTING); - - this.videoBroadcastObject.onChannelChangeSucceeded = function(channel) { - deferred.resolve(); - }; - - this.videoBroadcastObject.nextChannel && this.videoBroadcastObject.nextChannel(); - - return deferred.promise; - } - videoBroadcastService.setVolume = function(buttonId) { if (buttonId == "V+") { Modified: oipf/emulator/view/index.html =================================================================== --- oipf/emulator/view/index.html 2015-07-10 16:37:55 UTC (rev 1802) +++ oipf/emulator/view/index.html 2015-07-10 16:39:00 UTC (rev 1803) @@ -22,6 +22,7 @@ <script src="./emulator/js/services/ConfigurationService.js"></script> <script src="./emulator/js/services/SearchManagerService.js"></script> <script src="./emulator/js/services/VideoBroadcastService.js"></script> + <script src="./emulator/js/directives/ProgrammeProgress.js"></script> <script src="./emulator/js/contollers/RemoteControlController.js"></script> <script src="./emulator/js/contollers/VideoBroadcastController.js"></script> <script src="./emulator/js/contollers/PowerStateController.js"></script> @@ -43,24 +44,29 @@ </div> <div> <span ng-repeat="genre in genres">{{genre}} </span> + {{duration/60000}}MIN + <p class="csa"> {{parentalRating}} </p> </div> + <div> - <div class="col-md-1">12H45</div> - <div class="col-md-10"></div> - <div class="col-md-1">15h06</div> + <div class="col-md-1">{{startTime | date : 'HH:mm' : '+0200'}}</div> + <div class="col-md-10 border container"> + <div id="programmeState" ng-style="{{newWidth}}"> + </div> + </div> + <div class="col-md-1">{{stopTime | date : 'HH:mm' : '+0200'}}</div> </div> </div> </div> - <div class="off" id="powerStateView" ng-controller="PowerStateController" ng-class="state"> + <div class="off" ng-controller="PowerStateController" ng-class="state"> <div id="imgChannel" ng-show="beforeON"> <h1>EMULATOR</h1> </div> </div> - <object id="videoBroadcast" is="video-broadcast" ng-controller="VideoBroadcastController"> - <img class="pull-right" ng-src="{{chanLogo}}"/> + <img ng-show={{displayLogo}} class="pull-right" ng-src="{{chanLogo}}"/> <div id="volumeView" class="text-center" ng-show="volumeViewActive"> <div> <h3> @@ -202,19 +208,5 @@ </div> </div> -<!-- <div class="row" ng-controller="RemoteControlController"> - - <div id="emulator" class="col-9"> - <div>{{state}}</div> - </div> - - <div> - <div ng-repeat="row in remoteControl" style="text-align: center"> - <button ng-repeat="button in row.buttons" ng-click="remoteControlClick(button)">{{button}}</button> - </div> - </div> - - </div>--> - </body> </html>