YouTube videos can be included in
HTML documents, and Google offers the code to do so right on the same page as
the video itself!
The code offered by YouTube
includes a small handful of parameters that help customize the embedded video
object, and if you dive deep enough into the code, you will be able to identify
the <embed> element and see the src attribute pointing to the URL of the
media file.
The easiest way to play videos (others or your own) in
HTML is to use YouTube.
Playing a YouTube Video in HTML:
If you
want to play a video in a web page, you can upload the video to YouTube and
insert the proper HTML code to display the video:
Example :1 YouTube iFrame:
<iframe
width="420" height="345"
src="http://www.youtube.com/embed/XGSy3_Czz8k">
</iframe>
src="http://www.youtube.com/embed/XGSy3_Czz8k">
</iframe>
Example :2 YouTube iFrame
<!DOCTYPE html>
<html>
<head>
<title> video from
youtube</title>
</head>
<body>
<iframe width="420" height="345"
</iframe>
</body>
</html>
Example :1 YouTube Embedded:
<embed
width="420" height="345"
src="http://www.youtube.com/v/XGSy3_Czz8k"
type="application/x-shockwave-flash">
</embed>
width="420" height="345"
src="http://www.youtube.com/v/XGSy3_Czz8k"
type="application/x-shockwave-flash">
</embed>
Example :2 YouTube Embedded:
<object width="425"
height="344"><param name="movie"
value="http://www.youtube.com/v/opVb89Cmrtkamp;hl=enamp;fs=1">
</param><param name="allowFullScreen" value="true">
</param><param name="allowscriptaccess"
value="always"></param>
<embed
src="http://www.youtube.com/v/opVb89Cmrtk&hl=en&fs=1"
type="application/x-shockwave-flash"
allowscriptaccess="always" allowfullscreen="true"
width="425" height="344">
</embed>
</object>
html-embed attributes:
To
customize the functionality of the embedded media player, be sure to set any of
the following attributes.
- autostart - Controls the media's ability to start without prompting (values are "true" or "false")
- hidden - Controls whether or not the play/stop/pause embedded object is hidden or not (values are "true" or "false"; hide your embeded media if you just want background noise)
- loop - Controls the ability of the media to continuously play (values are "true" and "false")
- playcount - Sets a playcount which means the media will repeat itself x number of times, instead of continuously as with the loop attribute above (a playcount of "2" will repeat the video twice)
- volumn - Sets a numeric value for the loudness of your media (values are "0" through "100")
No comments:
Post a Comment