How do I play a youtube video in MATLAB App designer using HTML?

I am trying to embed and play a Youtube video using the HTML Component in the App Designer but am unable to do so. Is this even possible with the current 2020a release?

8 Comments

Aditya - what is the code that you are using to embed and play the video? Does the HTML code include something similar to
<iframe width="420" height="315"
src="https://www.youtube.com/linkToSomeVideo/videoId">
</iframe>
?
Yes, I included something similar but when I run the app it doesn't do anything.
I tested on R2020a using iframe embde code with uihtml. but it just shows blank screen.
Same here. I am able to open youtube in the browser through the dos command but having trobule embedding the video in the app. I also tried embedding a SurveyMonkey widget in the MATLAB App but that did not work either. I am not sure if I fully understand how this HTML component works.
I checked the documentations, following are currently listead as the limitations inluding embed code.
Limitations
  • You cannot link to URL web resources or embed applications from external web pages using the uihtml function.
  • HTML files that you specify for the HTMLSource property cannot access third-party JavaScript libraries by way of a Content Delivery Network (CDN). Save libraries in a location that your local file system can access.
  • Common web file types, like JavaScript and CSS, can be referenced from the HTML file you specify for the HTMLSource property, but other web file types might not be supported.
  • Content cannot overflow the bounds of the HTML UI component. If you are creating dynamic content, like pop-up widgets, make the size of your HTML UI component large enough to display the widget when the pop-up is in its opened state.
  • On MATLAB desktop, certain HTML features such as web plugins and access to webcams or microphones are not supported.
  • You cannot set the HTMLSource property to an HTML file that has query parameters appended to its file name. As a workaround, set these parameters in htmlComponent.Data.
  • Hyperlinks with matlab: operations are not supported.
Mohammad, From where have you got this limitation note?
The limitations are specified in the documentation.
https://www.mathworks.com/help/matlab/ref/uihtml.html
Did you ever find a work around? I am looking to do the same thing.

Sign in to comment.

Answers (1)

As of now, MATLAB R2020a does not support embedding of external web page such as youtube videos in html component. As mentioned in MATLAB Documentation.
One possible workaround is to download the video locally that you want to play as embedded and place it in same or sub folder of your HTML file. Then reference that video from you HTML file.

Categories

Find more on Package and Share Apps in Help Center and File Exchange

Products

Release

R2020a

Asked:

AT
on 10 Jun 2020

Answered:

on 11 Oct 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!