Janak
Janak

Reputation: 5052

How to embed an swf file having controls like video/audio Tag?

I tried searching various ways of embedding my swf files in to the browser using video, object and the embed tags.

video tag did not let me run the swf. This is what i had tried :

    <video controls>
       <object data="video.swf" width="320" height="240">
           <embed src="video.swf" width="320" height="240">
       </object> 
    </video>

I also tried:

    <video controls>
       <object data="video.swf" width="320" height="240"></object>
    </video>

and

But found no luck.

Then i tried the embed and the object tags:

    <embed src="video.swf" type="application/x-shockwave-flash" height="200" width="200">

    <object type="application/x-shockwave-flash" data="video.swf" height="200" width="200"> 

Both worked fine.

But i want to have the controls [play/pause/sound controls] that comes along with the video tag.

Is there any way i can have the controls along with embed or object tags ?

Or can i embed my swf file into the video tag ?

Any help would be appreciated.

Upvotes: 1

Views: 6529

Answers (1)

Jamie Taylor
Jamie Taylor

Reputation: 4765

If you'd like controls and you're trying to embed your own SWF File, you'll need to build the player yourself. Either through flash or by using JavaScript functions to send instructions into the flash file.

I'm assuming you're doing this for cross browser compatibility, If working in Actionscript doesn't sound like much fun (hint: it's not), you could use something like videoJS which would provide you with a fully featured player. I personally use MediaElement which I've found to suit my needs.

Upvotes: 3

Related Questions