htmlÔõô²åÊÓƵ
htmlÖÐǶÈëÊÓƵµÄÒªÁìÓÐËÄÖÖ£ºÊ¹Óà ±êÇ©Ö±½ÓǶÈëÊÓƵ£»Í¨¹ý javascript ´úÂëǶÈëÊÓƵ£»Ê¹ÓÃÊÓƵƽ̨ÌṩµÄǶÈë´úÂ룻ʹÓà ±êÇ©µÄÆäËûÊôÐÔ×Ô½ç˵ÊÓƵ²¥·Å¹¦Ð§¡£
ÔõÑùʹÓà HTML ǶÈëÊÓƵ
Ö±½ÓʹÓà Video ±êÇ©
Òª½«ÊÓƵֱ½ÓǶÈë HTML Ò³Ã棬ʹÓà ±êÇ©£º
<video width="320" height="240" controls><source src="video.mp4" type="video/mp4"></source></video>
µÇ¼ºó¸´ÖÆ
ͨ¹ý JavaScript ǶÈëÊÓƵ
Á¬Ã¦Ñ§Ï°¡°Ç°¶ËÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
ʹÓà JavaScript ¿ÉÒÔ¸üÎÞаµØ¿ØÖÆÊÓƵ²¥·Å£º
const video = document.createElement('video'); video.setAttribute('width', '320'); video.setAttribute('height', '240'); video.setAttribute('controls', true); const source = document.createElement('source'); source.setAttribute('src', 'video.mp4'); source.setAttribute('type', 'video/mp4'); video.appendChild(source); document.body.appendChild(video);
µÇ¼ºó¸´ÖÆ
ʹÓÃǶÈë´úÂë
һЩÊÓƵƽ̨ÌṩǶÈë´úÂ룬¿ÉÒÔÇáËɵؽ«ÊÓƵÌí¼Óµ½ HTML Ò³Ã棺
<!-- YouTube --> <iframe src="https://www.youtube.com/embed/yU43oeq_u0I" width="560" height="315"></iframe> <!-- Vimeo --> <iframe src="https://player.vimeo.com/video/123456789" width="500" height="338"></iframe>
µÇ¼ºó¸´ÖÆ
ÆäËûÊôÐÔ
±êÇ©»¹Ö§³ÖÐí¶àÆäËûÊôÐÔ£¬ÓÃÓÚ×Ô½ç˵ÊÓƵ²¥·Å¹¦Ð§£º
autoplay: ÉèÖÃÊÓƵ×Ô¶¯²¥·Å
loop: ÉèÖÃÊÓƵѻ·²¥·Å
muted: ÉèÖÃÊÓƵ¾²Òô²¥·Å
poster: ÉèÖÃÊÓƵ¼ÓÔØÇ°µÄ·âÃæͼÏñ
ÒÔÉϾÍÊÇhtmlÔõô²åÊÓƵµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£