I'm new to HTML5 and am trying to get a simple example working of calling a .swf video file from an HTML button (or similar).
I have gotten this code so far but it doesn't seem to work...
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<video src='test.swf' id='v' controls>
Your browser does not support HTML5 video.
</video>
</br>
<button onclick="document.getElementById('v').play()">Play</button>
<button onclick="document.getElementById('v').pause()">Pause</button>
</body>
</html>
Any help would be appreciated...
Developers who currently create Flash SWF files have several ways to switch to HTML5 including Adobe Animate and Google Web Designer. If you need to play an existing Flash SWF file in your browser alone, you might be able to use Mozilla's Shumway.
You can embed SWF content in HTML content within an AIR application just as you would in a browser. Embed the SWF content using an object tag, an embed tag, or both. Note: A common web development practice is to use both an object tag and an embed tag to display SWF content in an HTML page.
HTML5 is several years old now, and as the living standard of the language as a whole, it will only continue to get updated to work with the modern web.
You can use embed tag:
SWF with background
<embed src="main.swf" width="550" height="400" />
SWF WITH transparent background
<embed src="main.swf" width="550" height="400" wmode="transparent" />
SWF WITH FLASHVARS
<embed src="main.swf" width="550" height="400" flashvars="id=hello world" wmode="transparent" />
To control the swf, you need to use External Interface functions.
.swf is not a supported file format for the <video>
element the only supported file formats are MPEG-4/H.264 Ogg/Theora and WebM/VP8 with suppport for individual formats varying across browsers.
For information on which browsers support what, refer to the excellent caniuse.com.
For a run down of the HTML5 video element I highly recommend Operas Introduction to HTML5video
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With