Created
March 16, 2019 21:16
-
-
Save CarlosLevir/d07216239e65ef09ca49c24a5b743d10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { getUnsubscribedTrailer } from './services/youtubeVideosServices'; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
unsubscribedTrailer: '' | |
}; | |
} | |
componentDidMount = async () => { | |
const response = await getUnsubscribedTrailer(); | |
this.setState({ | |
unsubscribedTrailer: response.data.items[0].brandingSettings.channel.unsubscribedTrailer | |
}); | |
}; | |
render() { | |
const { unsubscribedTrailer } = this.state; | |
return ( | |
<div> | |
<iframe | |
title="VevoTrailer" | |
width="560" | |
height="315" | |
src={`https://www.youtube.com/embed/${unsubscribedTrailer}`} | |
frameBorder="0" | |
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" | |
allowFullScreen | |
/> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment