为什么使用 'youtube.com/v' 的 YouTube 视频没有加载

Why are YouTube videos using 'youtube.com/v' not loading

请复习this page

在移动设备上查看页面时会播放嵌入视频,但在计算机上查看时不会播放(在两台笔记本电脑上测试 运行 Windows 8 和 10,在 Chrome 、FF 和边缘)。

此问题仅存在于 YouTube 视频中,并且问题开始于 48 小时前(大约)

例如,查看此 YouTube URL(未加载视频):

http://www.youtube.com/v/RCsJHHUkisw&rel=0&color1=0x054b81&color2=0xe2e2e2&hd=1&showinfo=0&enablejsapi=1&playerapiid=ytplayer&fs=1

以下内容应该非常接近 the page referenced in the question(ID 为 emvideo-youtube-flash-2object 标签)当前服务的替代品:

<iframe id="ytplayer" type="text/html" width="590" height="499"
src="https://www.youtube.com/embed/Je2vE5RLJ6o?rel=1&showinfo=0&enablejsapi=1&fs=1&origin=http://www.islandcricket.lk/"
frameborder="0" allowfullscreen>

关于当前提供的实施的一些事情:

  • 使用 object 标签和 youtube 形式的嵌入 URLs。com/v/video id(仅提供 Flash 播放器,不提供 HTML5) 嵌入 YouTube 视频 has been deprecated for over a year.
  • 播放器参数hdis deprecated. The iFrame player (used in the above code), will automatically chose the best quality to display based on a variety of parameters. If you wish to control this you can use the Javascript API.
  • relshowinfoenablejsapifs 参数应继续像在以前的实施中那样发挥作用 (parameter documentaion here)
  • 当前实现中设置为sameDomainallowScriptAcess参数被origin参数取代,应设置为URL切断网页(documented here)

以上代码在 islandcricket.lk 上的截图通过 webdev 工具测试:

我已经通过重写 emvideo 模块成功地解决了这个问题。

我目前使用的模块版本 = "6.x-1.26".

我没有花时间更改整个模块;
我只更改了我需要的部分:

所有更改均在此文件中进行: \sites\all\modules\emfield\contrib\emvideo\providers\youtube.inc

  1. function theme_emvideo_youtube_flash 行 444 我更改了行

    $url = check_plain("http://www.youtube.com/v/$code&$related$autoplay_value$colors$border$high_quality$display_info$enablejsapi$fs");

    $url = check_plain("https://www.youtube.com/embed/$code");

我所做的是查看 youtube 嵌入代码并尝试使 link 看起来相同。

  1. 下一步是在第 566 行函数中更改 FLASH 输出 theme_emvideo_youtube_default_external 并更改下一个内容:

<div id="$div_id"> <object type="application/x-shockwave-flash" height="$height" width="$width" data="$url" id="$id"> <param name="movie" value="$url" /> <param name="allowScriptAccess" value="sameDomain"/> <param name="quality" value="best"/> <param name="allowFullScreen" value="$fullscreen_value"/> <param name="bgcolor" value="#FFFFFF"/> <param name="scale" value="noScale"/> <param name="salign" value="TL"/> <param name="FlashVars" value="$flashvars" /> <param name="wmode" value="transparent" /> </object> </div>

<div id="$url"><iframe width="$width" height="$width" src="$url" frameborder="0" allowfullscreen></iframe></div>

仅此而已……

希望对您有所帮助……