PLT-3049 Revert Google Api Key to show YouTube Previews (#3116)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
e5ec6c95b5
Коммит
21e4bc7c42
@@ -16,6 +16,7 @@ export default class YoutubeVideo extends React.Component {
|
|||||||
this.updateStateFromProps = this.updateStateFromProps.bind(this);
|
this.updateStateFromProps = this.updateStateFromProps.bind(this);
|
||||||
this.handleReceivedMetadata = this.handleReceivedMetadata.bind(this);
|
this.handleReceivedMetadata = this.handleReceivedMetadata.bind(this);
|
||||||
this.handleMetadataError = this.handleMetadataError.bind(this);
|
this.handleMetadataError = this.handleMetadataError.bind(this);
|
||||||
|
this.loadWithoutKey = this.loadWithoutKey.bind(this);
|
||||||
|
|
||||||
this.play = this.play.bind(this);
|
this.play = this.play.bind(this);
|
||||||
this.stop = this.stop.bind(this);
|
this.stop = this.stop.bind(this);
|
||||||
@@ -85,9 +86,15 @@ export default class YoutubeVideo extends React.Component {
|
|||||||
if (key) {
|
if (key) {
|
||||||
WebClient.getYoutubeVideoInfo(key, this.state.videoId,
|
WebClient.getYoutubeVideoInfo(key, this.state.videoId,
|
||||||
this.handleReceivedMetadata, this.handleMetadataError);
|
this.handleReceivedMetadata, this.handleMetadataError);
|
||||||
|
} else {
|
||||||
|
this.loadWithoutKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadWithoutKey() {
|
||||||
|
this.setState({loaded: true});
|
||||||
|
}
|
||||||
|
|
||||||
handleMetadataError() {
|
handleMetadataError() {
|
||||||
this.setState({
|
this.setState({
|
||||||
failed: true,
|
failed: true,
|
||||||
@@ -133,10 +140,6 @@ export default class YoutubeVideo extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (!global.window.mm_config.GoogleDeveloperKey) {
|
|
||||||
return <div/>;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.state.loaded) {
|
if (!this.state.loaded) {
|
||||||
return <div className='video-loading'/>;
|
return <div className='video-loading'/>;
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user