The time might come when you’re building a Power App and you need to embed a video from YouTube or another source to easily play when clicked on. For instance, you are creating an app for employees to track maintenance and you need to add a quick demonstration video to pop up on the interface along with the line item. Or, you’re creating a physical therapy application for your clients with a checklist of exercises, and you want to provide an instructional video to make sure they are doing the exercise correctly. The options are limitless.
This blog will show you how to play a YouTube video from a selected gallery item in your application using the physical therapy example above.
First you will insert a gallery. I imported an excel spreadsheet with the name of the exercise in one column and the YouTube video URL in the next column. Simple enough!
Once I imported my gallery, I moved it down the screen a bit. Up top is where I am going to put my video player. I choose Insert > Media > Video.
Now I have my video player up top and the gallery below.
My gallery is looking a little bare, but you can add in more information relating to your content as you please.
Next, since each gallery item has a different video, we want the video player to change every time a new gallery item is clicked.
We select the video player and make sure we have media selected in the Property drop down. We are going to change the value so that the corresponding video appears when the gallery item is selected.
We change the media property to say:
NameOfGallery.Selected.NameContainingYouTubeLink
In my instance, my gallery is called Gallery1 and my YouTube links were in a column called Demo when they were imported, so any text in those columns are under the Demo umbrella. If I only had one video to play on a screen (no gallery, no need for selection ), I could simply paste the YouTube link into Media text property. Mine reads:
Gallery1.Selected.Demo
Now my app displays the correct video when the corresponding gallery item is selected!
Power Apps does the rest of the work by reading the YouTube link and displaying the video. Voila!
Learn more about Aerie's PowerApps services:
Share