网页中视频自动播放的代码
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了网页中视频自动播放的代码相关的知识,希望对你有一定的参考价值。
偶用的代码如下:
<OBJECT id=Player height=150 width=260
classid=clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA
viewastext>
<PARAM NAME="_ExtentX" VALUE="12726">
<PARAM NAME="_ExtentY" VALUE="8520">
<PARAM NAME="AUTOSTART" VALUE="0">
<PARAM NAME="SHUFFLE" VALUE="0">
<PARAM NAME="PREFETCH" VALUE="0">
<PARAM NAME="NOLABELS" VALUE="0">
<PARAM NAME="CONTROLS" VALUE="ImageWindow">
<PARAM NAME="CONSOLE" VALUE="_master">
<PARAM NAME="LOOP" VALUE="0">
<PARAM NAME="NUMLOOP" VALUE="0">
<PARAM NAME="CENTER" VALUE="0">
<PARAM NAME="MAINTAINASPECT" VALUE="sp/01.rmvb">
<PARAM NAME="BACKGROUNDCOLOR" VALUE="#000000">
</OBJECT>
<OBJECT id=Player height=50 width=260
classid=clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA
viewastext>
<PARAM NAME="_ExtentX" VALUE="18256">
<PARAM NAME="_ExtentY" VALUE="794">
<PARAM NAME="AUTOSTART" VALUE="-1">
<PARAM NAME="SHUFFLE" VALUE="0">
<PARAM NAME="PREFETCH" VALUE="0">
<PARAM NAME="NOLABELS" VALUE="0">
<PARAM NAME="CONTROLS" VALUE="controlpanel">
<PARAM NAME="CONSOLE" VALUE="_master">
<PARAM NAME="LOOP" VALUE="0">
<PARAM NAME="NUMLOOP" VALUE="0">
<PARAM NAME="CENTER" VALUE="0">
<PARAM NAME="MAINTAINASPECT" VALUE="0">
<PARAM NAME="BACKGROUNDCOLOR" VALUE="#000000">
<PARAM NAME="SRC" VALUE="sp/01.rmvb">
</OBJECT>
以前可以播放,后来不能播放了,不知道是什么原因,是服务器安全设置的问题还是代码的问题呢?(中间服务器重装过一次)
代码和视频文件都没有改的。
HTML5中的video和audio标签中有一个autoplay属性,添加这个属性后就会在文件加载完成以后自动播放。具体代码如下: video: audio。
构成
文字与图片是构成一个网页的两个最基本的。
元素。你可以简单地理解为:文字,就是网页的内容。图片,就是网页的美观。除此之外,网页的元素还包括动画、音乐、程序等等。
在网页上点击鼠标右键,选择菜单中的 “查看源文件” ,就可以通过记事本看到网页的实际内容。可以看到网页实际上只是一个纯文本文件。它通过各式各样的标记对页面上的文字、图片、表格、声音等元素进行描述(例如字体、颜色、大小),而浏览器则对这些标记进行解释并生成页面。
于是就得到你现在所看到的画面。 为什么在源文件看不到任何图片? 网页文件中存放的只是图片的链接位置,而图片文件与网页文件是互相独立存放的,甚至可以不在同一台计算机上。
网页通常有以下元素:
文字资料图像档案Applet(在页面内执行的副程式)超链结网页的合成体为网站,一个网站的开始点为首页。
记录功能
当你每次上网时,都会在历史记录里留下记录,并且被保存在浏览器的缓存文件夹里,删除时只要右键删除就可以了。
以上内容参考:百度百科-网页
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>互动力量免费留言本</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/template3.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../js/editor.js"></script>
<SCRIPT language="JavaScript">
<!--
if (top.location != self.location)top.location=self.location;
// -->
</SCRIPT>
<style type="text/css">
body
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url("../../images/template/3/bg.jpg");
</style>
<script language="JavaScript" src="../../js/common.js"></script>
<script language="JavaScript" src="../../js/ubbcode.js"></script>
<script language="JavaScript">
function formCheck()
AttachSubmit();
if (document.theform.nickname.value == "")
alert("请填写名字。");
document.theform.nickname.focus();
return false;
if (document.theform.content.value == "")
alert("请填写留言内容。");
//document.theform.content.focus();
return false;
if (document.theform.GetCode.value == "")
alert("请填写验证码。");
document.theform.GetCode.focus();
return false;
//document.theform.SubmitBtn.disabled=true;
return true;
function CheckUploadCount()
if (document.theform.upload_file_count.value >= 1)
alert("每篇留言最多只能上传1个附件,现已达到上限。");
else
AP_popwin('upload.asp?userid=111433',4,400,80);
function showimage()
document.images.faceimg.src=face_image[parseInt(document.theform.face.options[document.theform.face.selectedIndex].value)];
face_image=new Array(16);
face_image[0]="../../images/m01.gif";
face_image[1]="../../images/m02.gif";
face_image[2]="../../images/m03.gif";
face_image[3]="../../images/m04.gif";
face_image[4]="../../images/m05.gif";
face_image[5]="../../images/m06.gif";
face_image[6]="../../images/m07.gif";
face_image[7]="../../images/m08.gif";
face_image[8]="../../images/m09.gif";
face_image[9]="../../images/m10.gif";
face_image[10]="../../images/m11.gif";
face_image[11]="../../images/m12.gif";
face_image[12]="../../images/m13.gif";
face_image[13]="../../images/m14.gif";
face_image[14]="../../images/m15.gif";
face_image[15]="../../images/m16.gif";
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../../images/template/3/top.jpg">
<tr>
<td width="1"><img src="../../images/blank.gif" width="1" height="101" /></td>
<td><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td><img src="../../images/blank.gif" width="16" height="1" /></td>
<td><center>
<IFRAME marginHeight=0 marginWidth=0 noResize scrolling=no frameBorder=0 src="http://ads.activepower.net/script/ad/ad_show.asp?group_id=8&bgcolor=ffffff" width=468 height=60>
</IFRAME>
</center>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table width="775" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="241"><img src="../../images/template/3/post_left.jpg" width="241" height="358" /></td>
<td background="../../images/template/3/post_right.jpg">
<form name="theform" onsubmit="return formCheck();" method="post" action="get_post.asp">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td width="19%"><font color="#FFFFFF"><strong>*</strong></font><img src="../../images/template/3/getbook_cooltext01.gif" width="64" height="20" align="absmiddle" /></td>
<td width="81%">
<input name="nickname" type="text" value="张添议" size="14" maxlength="12" />
</td>
</tr>
<tr>
<td><img src="../../images/template/3/getbook_cooltext02.gif" width="64" height="23" /></td>
<td><input name="email" type="text" id="email" size="14" /></td>
</tr>
<tr>
<td><img src="../../images/template/3/getbook_cooltext03.gif" width="64" height="27" /></td>
<td><input name="hp_url" type="text" id="hp_url" size="14" /></td>
</tr>
<tr>
<td colspan="2"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" style="border:1px solid #666666">
<tr>
<td colspan="2" class="Blackpt9">
<style type=text/css>
.outcolor
border:1 double;border-color:#dddddd #dddddd #dddddd #dddddd;cursor:pointer;background:efefef
.overcolor
border:1 double;border-color:#ffffff #999999 #999999 #ffffff;cursor:pointer;background:dddddd
.clickcolor
border:1 double;border-color:#999999 #ffffff #ffffff #999999;cursor:pointer;background:dddddd
.StatusBarBtnOff BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #ffffff
.StatusBarBtnOn BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #9BD7FF
.bawfilter:Gray
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<img src="../../images/editor/bold.gif" alt="粗体" width="16" height="16" align="absmiddle" class="outcolor" style="cursor: pointer;" onClick="FormatText('bold', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/italic.gif" alt="斜体" width="16" height="16" align="absmiddle" class="outcolor" style="cursor: pointer;" onClick="FormatText('italic', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/underline.gif" alt="下划线" width="16" height="16" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="FormatText('underline', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)">
<img src="../../images/editor/justifycenter.gif" alt="居中" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="FormatText('JustifyCenter', '')" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)"> <img src="../../images/editor/createlink.gif" alt="插入超级链接" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor: pointer;" onClick="InsertURL()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)">
<img src="../../images/editor/separator.gif" align="absmiddle">
<img src="../../images/editor/insertimage.gif" alt="插入网上图片,支持格式为:gif、jpg、png、bmp" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="InsertPIC(111433)" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/paint.gif" alt="涂鸦板" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="InsertPaint(111433)" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/swf.gif" width="16" height="16" align="absmiddle" alt="插入Flash" class=outcolor style="cursor:pointer;" onClick="InsertSWF()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/wmv.gif" width="16" height="16" align="absmiddle" alt="插入Windows Media" class=outcolor style="cursor:pointer;" onClick="InsertWMV()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/rm.gif" width="16" height="16" align="absmiddle" alt="插入Real Media" class=outcolor style="cursor:pointer;" onClick="InsertRM()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<img src="../../images/editor/separator.gif" align="absmiddle">
<img src="../../images/editor/table.gif" alt="插入表格" width="16" height="16" border="0" align="absmiddle" class=outcolor style="cursor:pointer;" onClick="TableInsert()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/insertrow.gif" width="16" height="16" align="absmiddle" alt="插入行" class=outcolor style="cursor:pointer;" onClick="TableRowInsertBelow()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/deleterow.gif" width="16" height="16" align="absmiddle" alt="删除行" class=outcolor style="cursor:pointer;" onClick="TableRowDelete()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/insertcolumn.gif" width="16" height="16" align="absmiddle" alt="插入列" class=outcolor style="cursor:pointer;" onClick="TableColInsertRight()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript"> <img src="../../images/editor/deletecolumn.gif" width="16" height="16" align="absmiddle" alt="删除列" class=outcolor style="cursor:pointer;" onClick="TableColDelete()" onMouseDown="setButtonStyle(this,2)" onMouseUp="setButtonStyle(this,1)" onMouseOver="setButtonStyle(this,1)" onMouseOut="setButtonStyle(this,0)" language="javascript">
<br>
<select id="selectFont" name="selectFont" onChange="FormatText('fontname', selectFont.options[selectFont.selectedIndex].value);" style="font-family: 宋体; font-size: 9pt" onmouseover="window.status='选择选定文字的字体。';return true;" onmouseout="window.status='';return true;">
<option selected>选择字体</option>
<option value="custom">自定义字体</option>
<option value="removeFormat">默认字体</option>
<option value="宋体">宋体</option>
<option value="黑体">黑体</option>
<option value="隶书">隶书</option>
<option value="幼圆">幼圆</option>
<option value="楷体_GB2312">楷体</option>
<option value="仿宋_GB2312">仿宋</option>
<option value="新宋体">新宋体</option>
<option value="华文彩云">华文彩云</option>
<option value="华文仿宋">华文仿宋</option>
<option value="华文新魏">华文新魏</option>
<option value="Arial">Arial</option>
<option value="Arial Black">Arial Black</option>
<option value="Arial Narrow">Arial Narrow</option>
<option value="Century">Century</option>
<option value="Courier New">Courier New</option>
<option value="Georgia">Georgia</option>
<option value="Impact">Impact</option>
<option value="Lucida Console">Lucida Console</option>
<option value="MS Sans Serif">MS Sans Serif</option>
<option value="System">System</option>
<option value="Symbol">Symbol</option>
<option value="Tahoma">Tahoma</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Verdana">Verdana</option>
<option value="Webdings">Webdings</option>
<option value="Wingdings">Wingdings</option>
</select>
<select language="javascript" id="FontSize" name="FontSize" title="字号大小" onChange="FormatText('fontsize',this[this.selectedIndex].value);" onmouseover="window.status='选择选定文字的字号大小。';return true;" onmouseout="window.status='';return true;">
<option class="heading" selected>字号</option>
<option value="1">一号</option>
<option value="2">二号</option>
<option value="3">三号</option>
<option value="4">四号</option>
<option value="5">五号</option>
<option value="6">六号</option>
<option value="7">七号</option>
</select>
<select id="formatSelect" name="formatSelect" onChange="FormatText('FormatBlock',this[this.selectedIndex].value);">
<option selected>段落格式</option>
<option value="<P>">普通</option>
<option value="<PRE>">已编排格式</option>
<option value="<H1>">标题一</option>
<option value="<H2>">标题二</option>
<option value="<H3>">标题三</option>
<option value="<H4>">标题四</option>
<option value="<H5>">标题五</option>
<option value="<H6>">标题六</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="72%" align="center">
<table width="98%">
<tr id="CodeMode" style="display:none;">
<td style="border:1px solid #cccccc" width="100%">
<textarea id="HtmlEditorContent" name="HtmlEditorContent" style="padding:6px; font-size:14px; WIDTH: 100%; HEIGHT: 200px"></textarea>
</td>
</tr>
<tr id="DesignMode">
<td style="border:1px solid #cccccc" width="100%">
<iframe id="HtmlEditor" name="HtmlEditor" MARGINHEIGHT="6" MARGINWIDTH="6" width="100%" height="200" frameborder="0" scrolling="yes"></iframe>
</td>
</tr>
<tr style="display:none;">
<td>
<img src="../../images/editor/editor.gif" align="absmiddle" id="HtmlDesign">
<img src="../../images/editor/html.gif" align="absmiddle" id="HtmlCode">
<img src="../../images/editor/browse.gif" align="absmiddle" id="HtmlView">
<textarea name="content" id="content" style="VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px"></textarea>
<div id="HtmlEditor_Temp_HTML" style="VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px"></div>
<input type="hidden" ID="ContentEdit" name="ContentEdit" value="">
<input type="hidden" ID="ModeEdit" name="ModeEdit" value="">
<input type="hidden" ID="ContentLoad" name="ContentLoad" value="">
<input type="hidden" ID="ContentFlag" name="ContentFlag" value="0">
<script language=javascript> HtmlEditor_Initialized() ; </script>
</td>
</tr>
</table>
</td>
<td width="28%" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td align="center"><font color="#000000">选择头像</font></td>
</tr>
<tr>
<td align="center"><select size="1" name="face" onchange="showimage()">
<option value="0" selected>好开心</option>
<option value="1">
好难过</option>
<option value="2">
好伤心</option>
<option value="3">
要唱歌</option>
<option value="4">
正哭泣</option>
<option value="5">
很满意</option>
<option value="6">
很惊喜</option>
<option value="7">
好生气</option>
<option value="8">
好害怕</option>
<option value="9">
真倒霉</option>
<option value="10">
扁着嘴</option>
<option value="11">
平常心</option>
<option value="12">
冒冷汗</option>
<option value="13">
伤脑筋</option>
<option value="14">
笑死了</option>
<option value="15">
好气愤</option>
</select>
</td>
</tr>
<tr>
<td align="center"><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="6"><img src="../../images/box10_tl.gif" width="6" height="5" /></td>
<td background="../../images/box10_tbg.gif"><img src="../../images/box10_tbg.gif" width="6" height="5" /></td>
<td width="6"><img src="../../images/box10_tr.gif" width="6" height="5" /></td>
</tr>
<tr>
<td width="6" background="../../images/box10_lbg.gif"><img src="../../images/box10_lbg.gif" width="6" height="5" /></td>
<td bgcolor="#FFFFFF"><p><img src="../../images/m01.gif" name="faceimg" id="faceimg" /></p>
</td>
<td width="6" background="../../images/box10_rbg.gif"><img src="../../images/box10_rbg.gif" width="6" height="5" /></td>
</tr>
<tr>
<td width="6"><img src="../../images/box10_bl.gif" width="6" height="5" /></td>
<td background="../../images/box10_bbg.gif"><img src="../../images/box10_bbg.gif" width="6" height="5" /></td>
<td width="6"><img src="../../images/box10_br.gif" width="6" height="5" /></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><img src="../../images/template/3/getbook_cooltext08.gif" width="97" height="22" /></td>
<td width="9%"><input name="GetCode" type="text" id="GetCode" size="4" maxlength="4" /></td>
<td width="17%"><img src="" width="72" height="18" id="GetCodeImg" /></td>
<td width="56%"><input name="SubmitBtn" id="SubmitBtn" type="image" src="../../images/template/3/button.GIF" border="0" />
<input name="replyer" type="hidden" value="" />
<input name="reply_content_id" type="hidden" value="" />
<input name="userid" type="hidden" value="111433" />
<input type="hidden" name="sum_upload_file_size" value="0" />
<input type="hidden" name="upload_files" value="" />本回答被提问者采纳
在嵌入式 YouTube 播放器中自动播放下一个视频
【中文标题】在嵌入式 YouTube 播放器中自动播放下一个视频【英文标题】:Autoplay next video in embedded YouTube player 【发布时间】:2016-07-03 07:13:05 【问题描述】:YouTube 上有一个自动播放功能,可以播放下一个推荐的视频。
如何在嵌入式 YouTube 播放器中启用此功能?
YouTube API here 解释了自动播放功能,但这并不相同。他们描述的功能是在网页加载后自动播放视频。
有没有办法在嵌入的视频帧中实现 YouTube 上的自动播放功能?
【问题讨论】:
问题可能重复。这可能会有所帮助:***.com/questions/19725950/… 【参考方案1】:<iframe src="https://www.youtube.com/embed/211t6r12XPQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
</iframe>
也许这是某个网站的 AI 或 UI 复制链接
【讨论】:
【参考方案2】:根据 youtube api 参考页面https://developers.google.com/youtube/iframe_api_reference中列出的选项
没有任何特定选项可以启用您正在寻找的功能。
但是,您可以通过其他方法来实现这一点,使嵌入式 youtube 视频播放器自动播放下一个视频。
为此,您必须从播放列表嵌入视频,而不是直接嵌入视频
<iframe src="https://www.youtube.com/embed/NTM4kxNjAIY?list=PLelK7aEMtfK2wpv7tv472alrDpNwO_0jw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
【讨论】:
【参考方案3】:据我了解,这个想法是使用嵌入式 youtube (YouTube Iframe-API) 与使用普通 youtube.com 的行为相同,并将自动播放设置为 true。
到目前为止,我发现的唯一方法是通过 api 调用获取 videoId,如下所述:https://***.com/a/19732072/10956686 然后在 PlayerState.ENDED 事件触发后使用 player.loadVideoById()。
function onPlayerStateChange(event)
if (event.data == YT.PlayerState.ENDED && !done)
player.loadVideoById(myFetchedNextVideoId);
但这可能会导致大量 API 配额的使用。
【讨论】:
以上是关于网页中视频自动播放的代码的主要内容,如果未能解决你的问题,请参考以下文章