问题
Please review this page.
The embedded video plays when the page is viewed on a mobile device but not when viewed on a computer (tested on two laptops running Windows 8 and 10, on Chrome, FF, and Edge).
This issue only exists with YouTube videos and the problem began 48 hours ago (approx.)
For example, see this YouTube URL (no video is being loaded):
http://www.youtube.com/v/RCsJHHUkisw&rel=0&color1=0x054b81&color2=0xe2e2e2&hd=1&showinfo=0&enablejsapi=1&playerapiid=ytplayer&fs=1
回答1:
I have managed to handle this problem by rewriting the emvideo module.
I am currently using the module version = "6.x-1.26".
I didn’t take the time to change the entire module;
I changed only the parts I needed:
All the changes were made in this file: \sites\all\modules\emfield\contrib\emvideo\providers\youtube.inc
In
function theme_emvideo_youtube_flash
line 444 I changed the line$url = check_plain("http://www.youtube.com/v/$code&$related$autoplay_value$colors$border$high_quality$display_info$enablejsapi$fs");
to
$url = check_plain("https://www.youtube.com/embed/$code");
.
What I did was to look at the youtube embed code and try to make the link look the same.
- Next step was to change the FLASH output, in line 566 function
theme_emvideo_youtube_default_external
and change the next content:
<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>
To
<div id="$url"><iframe width="$width" height="$width" src="$url" frameborder="0" allowfullscreen></iframe></div>
And that’s all…
Hope it helps a bit…
回答2:
The following should be pretty close to a drop-in replacement for what's currently being served on the page referenced in the question (the object
tag with id emvideo-youtube-flash-2
):
<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>
A few things about the implementation currently being served:
- Using
object
tag and the embed URLs of the form youtube.com/v/video id
(which only serves a Flash player, not HTML5) to embed YouTube videos has been deprecated for over a year. - the player parameter
hd
is 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. - the
rel
,showinfo
,enablejsapi
andfs
parameters should continue to function as they have in the previous implementation (parameter documentaion here) - The
allowScriptAcess
parameter set tosameDomain
in the current implementation is replaced by theorigin
parameter and should be set to the URL severing the webpage (documented here)
Screenshot of the above code working on islandcricket.lk tested via webdev tools:
来源:https://stackoverflow.com/questions/38917194/why-are-youtube-videos-using-youtube-com-v-not-loading