How to use embed or object in html5? - html

I know that <Applet> does not work in HTML5 but in 4.1, but how do i use <embed> or <object> becose if i use <embed src=SOMETHING.jar> or <object width="400" height="400" data="SOMETHING.jar"></object> it just downloads SOMETHING.jar.
How can i just (dis)play it?

Related

Get video from BLOB and play that video using struts2 action using <iframe> or <embed> tag

I can successfully open a video read from a BLOB by using <s:url action='downappsuservideo'/>, but it doesn't work when I put it in an embed tag.
How to play it inside the page ?
<embed src="<s:url action='downappsuservideo'/>"
type="application/x-shockwave-flash"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
name="mediaplayer1"
ShowStatusBar="true"
EnableContextMenu="false"
width="700"
height="500"
autostart="false"
loop="false"
align="middle"
volume="60">
</embed>
You don't need an iframe nor an embed tag. Just use HTML5 <video> tag that is the new, standard way:
<video src = "<s:url action='downappsuservideo'/>"
autoplay = "false"
width = "700"
height = "500"
loop = "false"
poster = "posterimage.jpg">
Sorry, your browser doesn't support embedded videos,
but don't worry, you can download it
and watch it with your favorite video player!
</video>

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

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

Embed mp3 in html

I used this code for embed a mp3 file to html:
<EMBED SRC="mp3 link" HEIGHT=60 WIDTH=300>];
the problem is that the browser download the file and than he play it,
there is any way for do it in buffer or something like this?
because i want the user will not wait.
For browsers that support HTML 5 you can use this:
<audio src="song.mp3" controls="controls">
Your browser does not support the audio element.
</audio>
Otherwise you'd have to use JQuery as suggested above, or a flash audio player.
Google has a good player :
<embed type="application/x-shockwave-flash" flashvars="audioUrl=MP3_FILE_URL" src="http://www.google.com/reader/ui/3523697345-audio-player.swf" width="400" height="27" quality="best"></embed>
Use the audio element of HTML5:
<audio src="[mp3 link]" preload controls></audio>

how to put flash (.swf) in a page?

i'm planning to use a .swf file as a header. this won't work.
<img src="exactheader.swf" width="650" height="140" />
can you tell me how?
Try this instead:
<object width="650" height="140">
<param name="movie" value="exactheader.swf">
<embed src="exactheader.swf" width="650" height="140"></embed>
</object>
You should use <embed> tag to embed flash files to an html page :
<object width="650" height="140">
<param name="movie" value="exactheader.swf">
<embed src="exactheader.swf" width="650" height="140"> </embed>
</object>
EDIT : As Russ pointed, I just found the resource why we should use both object and embed tags here.
In the code above there is both an
tag and an <object> tag. This
is because the tag is
recognized by Internet Explorer, and
Netscape recognizes the <embed> tag
and ignores the <object> tag.
I have found swfobject the 'best' method for embedding flash in html. It handles, version checking, alternate content, etc. Spend a few minutes getting familiar with this easy to use api:
http://code.google.com/p/swfobject/