Adding a video to migx

I found a video where this guy adds a video to the migx fields and when you check the resource, the video is embeded in the grid view, he doesnt show his json though

I check the documentation and it doesnt seem to include and inputTVtype for video

what am I missing?

Haven’t seen the video personally but there is no specific TV type for videos. I would suggest using a normal text field where your user can either paste in the complete YouTube url, or the video ID. Unfortunately there is no fancy YouTube get functionality via the API with this solution, unlike the moreGallery solution.

2 Likes

The guy in the video probably uses a simple textarea TV which is then put into a respective chunk. Like @lkfranklin mentioned, the best way to do it is probably to create a template chunk where the video embed code is in and just input the video ID in there with a simple text TV.

// Chunk:
<iframe src="https://www.youtube.com/embed/[[+videoID]]"></iframe>
3 Likes

Yeah, the guy in the video just uses a simple textarea inputTVtype
+1 for using a simple text intputTVtype and just put the video ID in it and use a chunk, like mentioned by @vibedesign

1 Like

And, in the same vein, you could also use youTubeId to extract the YouTube id from a YouTube URL. Might come in handy.

So your chunk would look like this:

// Chunk:
<iframe src="https://www.youtube.com/embed/[[+YouTubeUrl:getYouTubeId]]"></iframe>
1 Like

It looks like your link got mixed up, you probably wanted to link this.

1 Like

Haha indeed! Thanks for catching that.

2 Likes

thanks for the replies, but what I meant was the guy was rendering the youtube videos in his grid columns, like how images are rendered by using renderImage

I think you can use this.renderChunk and throw in renderOptions to specify a chunk. Check the documentation though on usage and syntax