Fix player parameters

pull/91/head
Omar Roth 6 years ago
parent d25146d22f
commit d75d34abdd

@ -129,45 +129,45 @@ 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()) {
player.markers.prev('Start'); player.markers.prev('Start');
} else { } else {
player.pause(); player.pause();
} }
} }
}, },
markers: [ markers: [
{time: <%= video_start %>, text: 'Start'}, {time: <%= video_start %>, text: 'Start'},
<% if video_end < 0 %> <% if video_end < 0 %>
{time: <%= video.info["length_seconds"].to_f - 0.5 %>, text: 'End'} {time: <%= video.info["length_seconds"].to_f - 0.5 %>, text: 'End'}
<% else %> <% else %>
{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>

@ -138,50 +138,50 @@ 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()) {
player.markers.prev('Start'); player.markers.prev('Start');
} else { } else {
player.pause(); player.pause();
} }
} }
}, },
markers: [ markers: [
{time: <%= video_start %>, text: 'Start'}, {time: <%= video_start %>, text: 'Start'},
<% if video_end < 0 %> <% if video_end < 0 %>
{time: <%= video.info["length_seconds"].to_f - 0.5 %>, text: 'End'} {time: <%= video.info["length_seconds"].to_f - 0.5 %>, text: 'End'}
<% else %> <% else %>
{time: <%= video_end %>, text: 'End'} {time: <%= video_end %>, text: 'End'}
<% end %> <% end %>
] ]
}); });
player.currentTime(<%= video_start %>);
<% end %>
this.currentTime(<%= video_start %>); <% if !listen %>
<% end %> var currentSources = player.currentSources();
for ( var i = 0; i < currentSources.length; i++ ) {
if (player.canPlayType(currentSources[i]['type'].split(';')[0]) === '') {
currentSources.splice(i);
i--;
}
}
<% if !listen %> player.src(currentSources);
var currentSources = player.currentSources(); <% end %>
for ( var i = 0; i < currentSources.length; i++ ) {
if (player.canPlayType(currentSources[i]['type'].split(';')[0]) === '') { <% if preferences %>
currentSources.splice(i); player.volume(<%= preferences.volume.to_f / 100 %>);
i--; player.playbackRate(<%= preferences.speed %>);
} <% end %>
}
player.src(currentSources);
<% end %>
<% if preferences %>
this.volume(<%= preferences.volume.to_f / 100 %>);
this.playbackRate(<%= preferences.speed %>);
<% end %>
});
function toggle(target) { function toggle(target) {
body = target.parentNode.parentNode.children[1]; body = target.parentNode.parentNode.children[1];

Loading…
Cancel
Save