Fix player parameters

This commit is contained in:
Omar Roth 2018-08-05 07:38:43 -05:00
parent d25146d22f
commit d75d34abdd
2 changed files with 81 additions and 81 deletions

View File

@ -129,11 +129,12 @@ var player = videojs('player', options, function() {
} }
} }
}); });
});
this.share(shareOptions); player.share(shareOptions);
<% if video_start > 0 || video_end > 0 %> <% if video_start > 0 || video_end > 0 %>
this.markers({ player.markers({
onMarkerReached: function(marker) { onMarkerReached: function(marker) {
if (marker.text === 'End') { if (marker.text === 'End') {
if (player.loop()) { if (player.loop()) {
@ -151,23 +152,22 @@ var player = videojs('player', options, function() {
{time: <%= video_end %>, text: 'End'} {time: <%= video_end %>, text: 'End'}
<% end %> <% end %>
] ]
}); });
this.currentTime(<%= video_start %>); player.currentTime(<%= video_start %>);
<% end %> <% end %>
<% if !listen %> <% if !listen %>
var currentSources = player.currentSources(); var currentSources = player.currentSources();
for ( var i = 0; i < currentSources.length; i++ ) { for ( var i = 0; i < currentSources.length; i++ ) {
if (player.canPlayType(currentSources[i]['type'].split(';')[0]) === '') { if (player.canPlayType(currentSources[i]['type'].split(';')[0]) === '') {
currentSources.splice(i); currentSources.splice(i);
i--; i--;
} }
} }
player.src(currentSources); player.src(currentSources);
<% end %> <% end %>
});
</script> </script>
</body> </body>

View File

@ -138,11 +138,12 @@ var player = videojs('player', options, function() {
} }
} }
}); });
});
this.share(shareOptions); player.share(shareOptions);
<% if video_start > 0 || video_end > 0 %> <% if video_start > 0 || video_end > 0 %>
this.markers({ player.markers({
onMarkerReached: function(marker) { onMarkerReached: function(marker) {
if (marker.text === 'End') { if (marker.text === 'End') {
if (player.loop()) { if (player.loop()) {
@ -160,28 +161,27 @@ var player = videojs('player', options, function() {
{time: <%= video_end %>, text: 'End'} {time: <%= video_end %>, text: 'End'}
<% end %> <% end %>
] ]
}); });
this.currentTime(<%= video_start %>); player.currentTime(<%= video_start %>);
<% end %> <% end %>
<% if !listen %> <% if !listen %>
var currentSources = player.currentSources(); var currentSources = player.currentSources();
for ( var i = 0; i < currentSources.length; i++ ) { for ( var i = 0; i < currentSources.length; i++ ) {
if (player.canPlayType(currentSources[i]['type'].split(';')[0]) === '') { if (player.canPlayType(currentSources[i]['type'].split(';')[0]) === '') {
currentSources.splice(i); currentSources.splice(i);
i--; i--;
} }
} }
player.src(currentSources); player.src(currentSources);
<% end %> <% end %>
<% if preferences %> <% if preferences %>
this.volume(<%= preferences.volume.to_f / 100 %>); player.volume(<%= preferences.volume.to_f / 100 %>);
this.playbackRate(<%= preferences.speed %>); player.playbackRate(<%= preferences.speed %>);
<% end %> <% end %>
});
function toggle(target) { function toggle(target) {
body = target.parentNode.parentNode.children[1]; body = target.parentNode.parentNode.children[1];