Can I include an AVI-file in my HTML-file generated by using "Publish to HTML" toolbar button in MATLAB?
10 views (last 30 days)
Show older comments
MathWorks Support Team
on 20 Jan 2010
Answered: Baptiste Ottino
on 8 Aug 2017
I have a MATLAB script that creates a movie. I would like to include this movie in the HTML document created by "Publish to HTML" or the PUBLISH command.
Accepted Answer
MathWorks Support Team
on 16 Oct 2018
The ability to include AVI-files in the HTML-file generated by the PUBLISH command is not currently available in MATLAB. To work around this issue, you can modify your HTML-file manually to include an AVI file (created using MOVIE2AVI) that shows your movie. To do this, follow these steps:
1. Create an AVI file using MOVIE2AVI. Place this file in the "html" subdirectory created when you used the "Publish to HTML" option. (The subdirectory will be in the same directory as the original MATLAB file that you published.)
2. Open the MATLAB-generated HTML-file with the MATLAB Editor/Debugger or another text editor. This file will be in the "html" subdirectory and will have the same name as the original program file, but with the extension ".html" instead of ".m".
3. Find the place where the movie command appears in the HTML. After the "movie(...)" text, there will be an image in the HTML which contains the last frame of the movie. Remove the "image" tags and everything in between.
4. In the spot in the HTML-file where the image was, add an AVI object to the HTML-file using the "object" tag, as in:
<object data="mymovie.avi" type="video/avi">
Text to Display if the Browser Doesn't Support AVI files.
</object>
This will include the AVI file in your HTML-file. Please note that many browsers do not support AVI objects, and the security options in your browser may also prevent the display of AVI objects.
0 Comments
More Answers (1)
Baptiste Ottino
on 8 Aug 2017
I have an alternative solution. If you don't want to modify your html file directly (for example because you want to be able to modify your m-file and republish), you can also directly use html tags inside your matlab script, as such:
% Here is a movie
% <html><object data="mymovie.avi" type="video/avi">Text to Display if the Browser Doesn't Support AVI files.
% </object></html>
If you don't use sound, the GIF format is pretty convenient for use in browsers:
% Here is a movie
% <html><img src="mymovie.gif"></html>
0 Comments
See Also
Categories
Find more on Movie in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!