Ann Sanderson
Ann Sanderson

Reputation: 407

Calling .swf From HTML5

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...

Upvotes: 8

Views: 35738

Answers (2)

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.

Upvotes: 9

Simon West
Simon West

Reputation: 3788

.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

Upvotes: 5

Related Questions