Hi,
I have put together what I think is a good work around. The steps are
as follows.
1) Load you KML as normal but have the URI to the desired FLVs in the
place-marks markup (I'm using the <Snippet> element so I can
'getSnippet' but you could use extended data, etc)
<Placemark id="pm1">
<name>Placemark 1</name>
<description>
Blagh blagh
</description>
<Point>
<coordinates>-2.228469,53.481518</coordinates>
</Point>
<Snippet maxLines="1" >
http://www.mysite.com/flv/video.flv
</Snippet>
<ExtendedData>
<Data name="flv">
<value>
http://www.mysite.com/flv/video.flv</value>
</Data>
</ExtendedData>
</Placemark>
2) Override the default placemark balloon by registering a click event
handler for the placemarks and using event.preventDefault() in the
handler function and call a custom HtmlDivBalloon ballon function.
google.earth.addEventListener(placemark, "click", function(event) {
event.stopPropagation();
event.preventDefault();
openVideoBalloon(event.getTarget());
}
);
3) Add the markup for the flash object to the HtmlDivBalloon and use
the stored URI to the FLV fie.
function openVideoBalloon(currentPlaceMark) {
var b = ge.createHtmlDivBalloon('');
b.setMaxWidth(800);
b.setFeature(currentPlaceMark);
ge.parseKml(currentPlaceMark.getKml())
var div = document.createElement('DIV');
div.innerHTML = '<b>'+currentPlaceMark.getName()+'</b>'
+' <div>'+currentPlaceMark.getDescription()+'</div>'
+' <div>'
+' <object height="175" width="210">'
+' <param value="'+currentPlaceMark.getSnippet()+'"
name="movie">'
+' <param value="transparent" name="wmode">'
+' <embed wmode="transparent" type="application/x-
shockwave-flash"'
+' src="'+currentPlaceMark.getSnippet()+'"
height="175" width="212">'
+' </object>'
+' </div>'
+' </div>';
b.setContentDiv(div);
ge.setBalloon(b);
}
5) Enjoy flash videos in placemarks using loaded kml!
I will post a simple example page so people can see how it's done. If
anyone else has any ideas or examples of how else to achieve this I'd
like to see!
Regards,
Fraser.
On Jun 25, 12:17 pm, ManoM wrote:
> Hi dorjee,
>
> Could you add that as a feature request?
http://groups.google.com/group/kml-support/web/earth-api-feature-requ...
>
> Mano
>
>
>
> dorjee wrote:
> > Hi,
> > what do you mean exactly with: "create a placemark programmatically"?
> > Is it when one puts a placemark in the script of the "GEmap" instead
> > of an embedded KML?
>
> > If yes, the problem is for a lot of placemarks, say more than 1.000!
> > I hope that this problem of security will be resolved one day without
> > that kind of limitation. I recall that in GE application one can
> > display YouTube, DailyMotion and any other Flash (flv) videos, with
> > the appropriate flash player. This functionnality seems to me highly
> > necessary in the GE plugin.- Hide quoted text -