Skip to content

Commit 4721b8a

Browse files
author
dularion
committed
add callbacks & add new callback onEpisodeChange to player.service
1 parent 3b67a7e commit 4721b8a

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

www/js/player/services/player.service.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ angular.module('streama.player').factory('playerService',
2121
destroyPlayer: destroyPlayer,
2222
handleSocketEvent: handleSocketEvent,
2323
onNext: onNext,
24-
onVideoClick: onVideoClick
24+
onVideoClick: onVideoClick,
25+
onEpisodeChange: onEpisodeChange
2526
};
2627

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

5758
console.log('%c videoOptions', 'color: deeppink; font-weight: bold; text-shadow: 0 0 5px deeppink;', videoOptions);
5859
videoData = video;
60+
61+
videoOptions.onPlay = this.onVideoPlay.bind(videoOptions);
62+
videoOptions.onPause = this.onVideoPause.bind(videoOptions);
63+
videoOptions.onError = this.onVideoError.bind(videoOptions);
64+
videoOptions.onTimeChange = this.onVideoTimeChange.bind(videoOptions);
65+
videoOptions.onClose = this.onVideoClose.bind(videoOptions);
66+
videoOptions.onNext = this.onNext.bind(videoOptions);
67+
videoOptions.onVideoClick = this.onVideoClick.bind(videoOptions);
68+
videoOptions.onSocketSessionCreate = this.onSocketSessionCreate.bind(videoOptions);
69+
videoOptions.onEpisodeChange = this.onEpisodeChange.bind(videoOptions);
70+
5971
return videoOptions;
6072

6173

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

103-
videoOptions.onPlay = this.onVideoPlay.bind(videoOptions);
104-
videoOptions.onPause = this.onVideoPause.bind(videoOptions);
105-
videoOptions.onError = this.onVideoError.bind(videoOptions);
106-
videoOptions.onTimeChange = this.onVideoTimeChange.bind(videoOptions);
107-
videoOptions.onClose = this.onVideoClose.bind(videoOptions);
108-
videoOptions.onNext = this.onNext.bind(videoOptions);
109-
videoOptions.onVideoClick = this.onVideoClick.bind(videoOptions);
110-
videoOptions.onSocketSessionCreate = this.onSocketSessionCreate.bind(videoOptions);
115+
111116

112117
return videoOptions;
113118
}
@@ -316,4 +321,8 @@ angular.module('streama.player').factory('playerService',
316321
$rootScope.$broadcast('triggerVideoToggle');
317322
}
318323
}
324+
325+
function onEpisodeChange(episode) {
326+
$state.go('player', {videoId: episode.id});
327+
}
319328
});

0 commit comments

Comments
 (0)