Modify lead function for lead-in
This commit is contained in:
parent
6a2e7bb9e2
commit
851491e4ac
3 changed files with 46 additions and 7 deletions
|
|
@ -761,6 +761,7 @@ var CustomPlayer = function (data) {
|
|||
};
|
||||
|
||||
function handleMediaUpdate(data) {
|
||||
var wait = data.currentTime < 0;
|
||||
// Media change
|
||||
if(data.id && data.id !== PLAYER.videoId) {
|
||||
if(data.currentTime < 0)
|
||||
|
|
@ -768,6 +769,12 @@ function handleMediaUpdate(data) {
|
|||
PLAYER.load(data);
|
||||
PLAYER.play();
|
||||
}
|
||||
|
||||
if (wait) {
|
||||
PLAYER.seek(0);
|
||||
PLAYER.pause();
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't synch if leader or synch disabled
|
||||
if(CLIENT.leader || !USEROPTS.synch)
|
||||
|
|
@ -775,8 +782,12 @@ function handleMediaUpdate(data) {
|
|||
|
||||
// Handle pause/unpause
|
||||
if(data.paused) {
|
||||
PLAYER.seek(data.currentTime);
|
||||
PLAYER.pause();
|
||||
PLAYER.isPaused(function (paused) {
|
||||
if (!paused) {
|
||||
PLAYER.seek(data.currentTime);
|
||||
PLAYER.pause();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
PLAYER.isPaused(function (paused) {
|
||||
if(paused)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue