我一直在排除故障,并在数小时内寻找答案,但无济于事.正在逐字使用API文档中的示例代码.其他人发布和说在IE9上运行的示例代码不适合我.我已经确认在html中正确设置了doctype,我没有在CSS中使用display = none隐藏iframe,浏览器模式是IE9,文档模式是IE9标准.我的安全设置配置为中等高.甚至谷歌的示例页面在我的IE9浏览器中对我不起作用.
https://developers.google.com/youtube/youtube_player_demo
当我点击"播放"试图让电影播放时(在上面的链接中),我在IE的脚本调试控制台中得到各种错误.第一个错误如下所示:
SCRIPT5009:'视频'未定义
请帮忙!我的示例代码如下.电影加载,我看到"API已准备就绪"警报,但IE9中没有其他任何事件会触发.我只是不知道我错过了什么!如果我不想很快解决这个问题,我将不得不放弃在我的项目中使用YouTube进行html5视频播放.
<!DOCTYPE html>
<html>
<head><title></title></head>
<body>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
<script type="text/javascript">
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
// This is a protocol-relative URL as described here:
// http://paulirish.com/2010/the-protocol-relative-url/
// If you're testing a local page accessed via a file:/// URL, please set tag.src to
// "https://www.youtube.com/iframe_api" instead.
//tag.src = "//www.youtube.com/iframe_api";
tag.src = "https://www.youtube.com/iframe_api"; …Run Code Online (Sandbox Code Playgroud)