Jump to content

YouTube video in a Google Map Info Window

- - - - -

  • Please log in to reply
No replies to this topic

#1
Trufa

Trufa

    Newbie

  • Members
  • Pip
  • 8 posts
Administrators/Moderators: Please check that this is the right place for this thread. (maybe javascipt?) Thanks!

------------------------

I am trying to put a youtube video into a Google Map (v3) Info Window.

It works fine in Firefox and Internet Explorer.

It does not work in Safari and Chrome. In those browsers the positioning is off and the video doesn't move when you move the map. The video also gets chopped sometimes.

Here is the code that doe


<!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>

An example of it working fine for the Google Maps API version 2 is here Virtual Video Map

Also on Google Maps You can see youtube videos inside the Info Window working in Chrome and Safari by clicking "More..." on the top right of the map, and then checking "Videos".




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users