Slightly more aggressive video preloading
- Preload video metadata if the video is loaded in detailed view, as it is likely to get played, and metadata is useful for seeking in the video. - Preload video data if it's fullscreen as it is extremely likely to get played right after being put in fullscreen (although those are two steps). - Preload video data if the user has clicked the position slider, as the video will play as soon as the mouse button is released, and video metadata is needed to properly seek into the video.lolsob-rspec
parent
99b2e034c2
commit
919bd0842d
|
@ -295,6 +295,15 @@ export default class Video extends React.PureComponent {
|
||||||
warning = <FormattedMessage id='status.media_hidden' defaultMessage='Media hidden' />;
|
warning = <FormattedMessage id='status.media_hidden' defaultMessage='Media hidden' />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let preload;
|
||||||
|
if (startTime || fullscreen || dragging) {
|
||||||
|
preload = 'auto';
|
||||||
|
} else if (detailed) {
|
||||||
|
preload = 'metadata';
|
||||||
|
} else {
|
||||||
|
preload = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames('video-player', { inactive: !revealed, detailed, inline: inline && !fullscreen, fullscreen, letterbox, 'full-width': fullwidth })}
|
className={classNames('video-player', { inactive: !revealed, detailed, inline: inline && !fullscreen, fullscreen, letterbox, 'full-width': fullwidth })}
|
||||||
|
@ -309,7 +318,7 @@ export default class Video extends React.PureComponent {
|
||||||
ref={this.setVideoRef}
|
ref={this.setVideoRef}
|
||||||
src={src}
|
src={src}
|
||||||
poster={preview}
|
poster={preview}
|
||||||
preload={startTime ? 'auto' : 'none'}
|
preload={preload}
|
||||||
loop
|
loop
|
||||||
role='button'
|
role='button'
|
||||||
tabIndex='0'
|
tabIndex='0'
|
||||||
|
|
Loading…
Reference in New Issue