Skip to content

Commit

Permalink
add callbacks & add new callback onEpisodeChange to player.service
Browse files Browse the repository at this point in the history
  • Loading branch information
dularion committed Oct 15, 2017
1 parent 3b67a7e commit 4721b8a
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions www/js/player/services/player.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ angular.module('streama.player').factory('playerService',
destroyPlayer: destroyPlayer,
handleSocketEvent: handleSocketEvent,
onNext: onNext,
onVideoClick: onVideoClick
onVideoClick: onVideoClick,
onEpisodeChange: onEpisodeChange
};

/**
Expand Down Expand Up @@ -56,6 +57,17 @@ angular.module('streama.player').factory('playerService',

console.log('%c videoOptions', 'color: deeppink; font-weight: bold; text-shadow: 0 0 5px deeppink;', videoOptions);
videoData = video;

videoOptions.onPlay = this.onVideoPlay.bind(videoOptions);
videoOptions.onPause = this.onVideoPause.bind(videoOptions);
videoOptions.onError = this.onVideoError.bind(videoOptions);
videoOptions.onTimeChange = this.onVideoTimeChange.bind(videoOptions);
videoOptions.onClose = this.onVideoClose.bind(videoOptions);
videoOptions.onNext = this.onNext.bind(videoOptions);
videoOptions.onVideoClick = this.onVideoClick.bind(videoOptions);
videoOptions.onSocketSessionCreate = this.onSocketSessionCreate.bind(videoOptions);
videoOptions.onEpisodeChange = this.onEpisodeChange.bind(videoOptions);

return videoOptions;


Expand Down Expand Up @@ -100,14 +112,7 @@ angular.module('streama.player').factory('playerService',
videoOptions.customStartingTime = 0;
}

videoOptions.onPlay = this.onVideoPlay.bind(videoOptions);
videoOptions.onPause = this.onVideoPause.bind(videoOptions);
videoOptions.onError = this.onVideoError.bind(videoOptions);
videoOptions.onTimeChange = this.onVideoTimeChange.bind(videoOptions);
videoOptions.onClose = this.onVideoClose.bind(videoOptions);
videoOptions.onNext = this.onNext.bind(videoOptions);
videoOptions.onVideoClick = this.onVideoClick.bind(videoOptions);
videoOptions.onSocketSessionCreate = this.onSocketSessionCreate.bind(videoOptions);


return videoOptions;
}
Expand Down Expand Up @@ -316,4 +321,8 @@ angular.module('streama.player').factory('playerService',
$rootScope.$broadcast('triggerVideoToggle');
}
}

function onEpisodeChange(episode) {
$state.go('player', {videoId: episode.id});
}
});

0 comments on commit 4721b8a

Please sign in to comment.