mirror of
https://github.com/iv-org/invidious.git
synced 2025-06-13 05:37:44 +02:00
Add option to control preloading of video data
Fix #4110 by adding an option to control the preloading of video data on page load. If disabled ("false"), the browser will not preload any video data until the user explicitly hits the "Play" button. If enabled ("true"), the default behavior will be used, which means the browser decides how much of the video will be preloaded.
This commit is contained in:
@ -3,7 +3,6 @@ var player_data = JSON.parse(document.getElementById('player_data').textContent)
|
||||
var video_data = JSON.parse(document.getElementById('video_data').textContent);
|
||||
|
||||
var options = {
|
||||
preload: 'auto',
|
||||
liveui: true,
|
||||
playbackRates: [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0],
|
||||
controlBar: {
|
||||
@ -35,6 +34,10 @@ if (player_data.aspect_ratio) {
|
||||
options.aspectRatio = player_data.aspect_ratio;
|
||||
}
|
||||
|
||||
if (player_data.preload) {
|
||||
options.preload = player_data.preload
|
||||
}
|
||||
|
||||
var embed_url = new URL(location);
|
||||
embed_url.searchParams.delete('v');
|
||||
var short_url = location.origin + '/' + video_data.id + embed_url.search;
|
||||
|
Reference in New Issue
Block a user