add internal video loading screen component

This commit is contained in:
Sean Yesmunt 2017-06-06 21:12:45 -07:00
parent 059673983c
commit 57a7d1db97
3 changed files with 49 additions and 21 deletions

View file

@ -0,0 +1,12 @@
import React from "react";
const LoadingScreen = ({ statusMessage }) =>
<div className="video--loading--screen">
<div className="loading--spinner" />
<div>
{statusMessage}
</div>
</div>;
export default LoadingScreen;

View file

@ -4,6 +4,7 @@ import Link from "component/link";
import Modal from "component/modal";
import lbry from "lbry";
import { Thumbnail } from "component/common";
import LoadingScreen from "./internal/loading-screen";
class VideoPlayButton extends React.Component {
onPurchaseConfirmed() {
@ -148,31 +149,27 @@ class Video extends React.Component {
return (
<div className={klassName}>
{isPlaying
? !isReadyToPlay
? <span>
{__(
"this is the world's worst loading screen and we shipped our software with it anyway..."
)}
{" "}<br /><br />{loadStatusMessage}
</span>
{isPlaying &&
(!isReadyToPlay
? <LoadingScreen status={loadStatusMessage} />
: <VideoPlayer
filename={fileInfo.file_name}
poster={poster}
downloadPath={fileInfo.download_path}
mediaType={mediaType}
poster={poster}
/>
: <div
className="video__cover"
style={{ backgroundImage: 'url("' + metadata.thumbnail + '")' }}
>
<VideoPlayButton
startPlaying={this.startPlaying.bind(this)}
{...this.props}
mediaType={mediaType}
/>
</div>}
/>)}
{!isPlaying &&
<div
className="video__cover"
style={{ backgroundImage: 'url("' + metadata.thumbnail + '")' }}
>
<VideoPlayButton
startPlaying={this.startPlaying.bind(this)}
{...this.props}
mediaType={mediaType}
/>
</div>}
</div>
);
}

View file

@ -13,7 +13,6 @@ video {
color: white;
}
.video-embedded {
max-width: $width-page-constrained;
max-height: $height-video-embedded;
@ -28,6 +27,26 @@ video {
&.video--active {
/*background: none;*/
}
.video--loading--screen {
.loading--spinner {
width: 100px;
height: 100px;
background-color: white;
margin: auto;
animation-name: spin;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-timing-function: linear;
@keyframes spin {
from { transform: rotate(0deg) }
to { transform: rotate(-360deg) }
}
}
}
.plyr {
top: 50%;
transform: translateY(-50%);
@ -61,4 +80,4 @@ video {
opacity: 1;
transition: opacity $transition-standard;
}
}
}