Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent youtube videos from auto-looping #17

Merged
merged 2 commits into from
Feb 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build/mediaelement-and-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,8 @@ mejs.YouTubeApi = {
pluginMediaElement.paused = true;
pluginMediaElement.ended = true;
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'loadedmetadata');
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'unstarted');
mejs.YouTubeApi.toggleTimeupdates(player, pluginMediaElement, false);
break;
case YT.PlayerState.ENDED:
pluginMediaElement.paused = false;
Expand Down Expand Up @@ -2923,7 +2925,7 @@ function isAfter(sourceNode, targetNode) {

}
}
t.media.pause();
t.media.stop();

if (t.setProgressRail) {
t.setProgressRail();
Expand Down Expand Up @@ -3796,6 +3798,9 @@ function isAfter(sourceNode, targetNode) {
media.addEventListener('paused',function() {
togglePlayPause('pse');
}, false);
media.addEventListener('unstarted',function() {
togglePlayPause('pse');
}, false);
}
});

Expand Down
31 changes: 28 additions & 3 deletions build/mediaelement-and-player.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions build/mediaelement.js
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,8 @@ mejs.YouTubeApi = {
pluginMediaElement.paused = true;
pluginMediaElement.ended = true;
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'loadedmetadata');
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'unstarted');
mejs.YouTubeApi.toggleTimeupdates(player, pluginMediaElement, false);
break;
case YT.PlayerState.ENDED:
pluginMediaElement.paused = false;
Expand Down
16 changes: 15 additions & 1 deletion build/mediaelement.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion build/mediaelementplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ function isAfter(sourceNode, targetNode) {

}
}
t.media.pause();
t.media.stop();

if (t.setProgressRail) {
t.setProgressRail();
Expand Down Expand Up @@ -1664,6 +1664,9 @@ function isAfter(sourceNode, targetNode) {
media.addEventListener('paused',function() {
togglePlayPause('pse');
}, false);
media.addEventListener('unstarted',function() {
togglePlayPause('pse');
}, false);
}
});

Expand Down
16 changes: 14 additions & 2 deletions build/mediaelementplayer.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/js/me-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,8 @@ mejs.YouTubeApi = {
pluginMediaElement.paused = true;
pluginMediaElement.ended = true;
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'loadedmetadata');
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'unstarted');
mejs.YouTubeApi.toggleTimeupdates(player, pluginMediaElement, false);
break;
case YT.PlayerState.ENDED:
pluginMediaElement.paused = false;
Expand Down
3 changes: 3 additions & 0 deletions src/js/mep-feature-playpause.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
media.addEventListener('paused',function() {
togglePlayPause('pse');
}, false);
media.addEventListener('unstarted',function() {
togglePlayPause('pse');
}, false);
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/js/mep-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ function isAfter(sourceNode, targetNode) {

}
}
t.media.pause();
t.media.stop();

if (t.setProgressRail) {
t.setProgressRail();
Expand Down