How to successfully embed youtube videos on google interactive canvas when played on google hub?
Background:
I'm working on a project to use google actions to be used on google nest hub. I've set up a canvas with a website URL that was built using ReactJS. I've a scene to display an embedded youtube videos on my website which will be displayed on google nest hub.
Problem:
The embedded youtube videos doesn't load/work when I test it on google nest hub (alpha test version deployment) but it works when I test it on my actions console (refer to image #1) and my Samsung device. What I would define as working is the youtube video was able to be loaded and user can interact with it using the button on the player. I get blank iframe on google nest hub although source has been loaded on iframe (refer to image #2).
#1 Youtube videos on actions console
#2 Youtube videos on google nest hub
On this screen, I've set up 5 way of embedding a youtube video on a ReactJS apps:
- Using react-player
- Using our built-in player using Youtube iframe API
- Using iframe tag
- Using object tag
- Using video tag with local mp4 file
Sample Code:
You can refer to following JSfiddle: YoutubeTestCode
For the sample code, I would just provide the code for iframe tag and object tag because I believe the rest is similar with these methods.
const VideoApp = () => {
return (
<div className="container">
<div className="grid">
<div className="card">
<div>3. Iframe Tag</div>
<div>Source: https://www.youtube.com/embed/tgbNymZ7vqY</div>
<iframe
id="blank-iframe"
width="95%"
height="140px"
src="https://www.youtube.com/embed/tgbNymZ7vqY">
</iframe>
</div>
</div>
<div className="grid">
<div className="card">
<div>4. Object Tag</div>
<div>Source: https://www.youtube.com/embed/tgbNymZ7vqY</div>
<object
id="object-method"
data="https://www.youtube.com/embed/tgbNymZ7vqY"
width="95%"
height="140px"
>
</object>
</div>
</div>
</div>
)
}
If you need more info, pls let me know. Thanks !!!