Google地图信息窗口中的YouTube视频

Dre*_*eur 11 youtube google-maps-api-3

我正在尝试将YouTube视频放入Google Map(v3)信息窗口.

它在Firefox和Internet Explorer中运行良好.

它并没有在Safari和Chrome的工作.在这些浏览器中,定位关闭,移动地图时视频不会移动.该视频有时会被切断.

这是代码

<!doctype html>
<html>
<head>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
var map;
function initialize() {
    latlng = new google.maps.LatLng(33.4222685, -111.8226402)
    myOptions = {
      zoom: 4,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map"),myOptions)
    var point = new google.maps.LatLng(33.4222685, -111.8226402);
    var marker = new google.maps.Marker({
        position: point,
        map: map
    })
    google.maps.event.addListener(marker, "click", function(){
        bubble = new google.maps.InfoWindow({
          content: '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/UmFjNiiVk9w?fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/UmFjNiiVk9w?fs=1" type="application/x-shockwave-flash" width="425" height="344" allowscriptaccess="always" allowfullscreen="true"></embed></object>'
        })
        bubble.open(map, marker);
    })
}
</script>
</head>
<body onload="initialize();">
  <div id="map" style="width: 984px; height: 495px"></div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

它适用于Google Maps API版本2的一个例子是http://www.virtualvideomap.com/

也可以在http://maps.google.com上点击地图右上角的"更多...",然后选中"视频",即可在Chrome和Safari中查看信息窗口内的YouTube视频.