8

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

2 Answers 2

9

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.

Sign up to request clarification or add additional context in comments.

Comments

5

.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

4 Comments

I came across this posting that seems to indicate that you can play .swf files in HTML5: answers.yahoo.com/question/index?qid=20100520080940AAQXjxU namely the "Best Answer": ----------------------------------------------------------------------------------- <object> <param> <embed> <- but this tag is new to HTML5 <object width='640' height='480' > <param name='flash' value='flash.swf' /> <embed src='flash.swf' width='640' height='480' /> </object> ----------------------------------------------------------------------------------- Is this not correct?
the embed tag is really 'new' to HTML5 its an old tag that was deprecated in HTML4 and then reintroduced in HTML5, much like some other tags like <b> and <i> you can indeed use that to play .swf files but again, you cant use the <video> tag to play swf.
Can you show me how to use the embed tag to play a .swf file? I can't seem to get it working in the .html I have?
I've tried lots of examples from the web but nothing seems to work. If anyone can provide a snippet of code that uses the embed tag with HTML and .swf files I'd appreciate it...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.