Skip to content

Instantly share code, notes, and snippets.

@CarlosLevir
Created March 16, 2019 21:16
Show Gist options
  • Save CarlosLevir/d07216239e65ef09ca49c24a5b743d10 to your computer and use it in GitHub Desktop.
Save CarlosLevir/d07216239e65ef09ca49c24a5b743d10 to your computer and use it in GitHub Desktop.
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