Embed Flash video ?

191 views
Skip to first unread message

Florent THIERY

unread,
Jun 9, 2008, 6:03:06 AM6/9/08
to KML Developer Support - Google Earth Browser Plugin
Is/will it be possible to embed Flash video (or other formats)
directly into the Google Earth Browser plugin ?

Robert S

unread,
Jun 10, 2008, 9:41:18 AM6/10/08
to KML Developer Support - Google Earth Browser Plugin
On Jun 9, 6:03 am, Florent THIERY wrote:
> Is/will it be possible to embed Flash video (or other formats)
> directly into the Google Earth Browser plugin ?

This should work. Example:

http://code.google.com/apis/kml/documentation/kmlreference.html#samplevideo

marquies

unread,
Jun 11, 2008, 4:12:40 AM6/11/08
to KML Developer Support - Google Earth Browser Plugin
Yes you can. Run this code in the sample page (http://www.google.com/
earth/plugin/examples/samples/)

var feature = null;
if (window.placemark) {
feature = window.placemark;
}
var b = ge.createHtmlDivBalloon('');
b.setMaxWidth(800);
b.setFeature(feature);
var div = document.createElement('DIV');
div.innerHTML =
'<div style="font-size:larger">'
+' <div>'
+' <div style="width: 212px; font-size: 12px;">'
+' <b>The Spaghetti Film</b>'
+' </div>'
+' <div style="font-size: 11px;">'
+' <a target="_blank" href="http://www.youtube.com/?
v=FICUvrVlyXc">'
+' http://www.youtube.com/?v=FICUvrVlyXc</a><br>'
+' </div><br>'
+' <div style="margin-left: auto; margin-right:auto;">'
+' <object height="175" width="212">'
+' <param value="http://www.youtube.com/v/FICUvrVlyXc"
name="movie">'
+' <param value="transparent" name="wmode">'
+' <embed wmode="transparent" type="application/x-
shockwave-flash"'
+' src="http://www.youtube.com/v/FICUvrVlyXc"
height="175"'
+' width="212">'
+' </object>'
+' </div>'
+' </div>'
+' </div>'
+' <div style="font-size: smaller; margin-top: 1em;">Saved
from '
+' <a href="http://maps.google.com/ig/add?
synd=mpl&pid=mpl&moduleurl='
+' http:%2F%2Fwww.google.com%2Fig%2Fmodules%2Fmapplets-
youtube.xml&hl=en&gl=us">'
+' YouTubeVideos</a>'
+' </div>';
b.setContentDiv(div);
ge.setBalloon(b);


regards
marquies
www.GONICUS.de
> http://code.google.com/apis/kml/documentation/kmlreference.html#sampl...

dorjee

unread,
Jun 14, 2008, 7:25:25 PM6/14/08
to KML Developer Support - Google Earth Browser Plugin
I'm sorry but I tried I tried... Nothing works for now.
I made a Video.kml with this code from:

http://code.google.com/apis/kml/documentation/kmlreference.html#samplevideo

I put it online here:

http://www.panoramearth.com/kmz/Video.kml

Then I joined the example page:

http://www.google.com/earth/plugin/examples/samples/

I chose "Fetch good kml" and modified it with Video.kml url (changing
the la.set too):

*****************************************************************
function finished(object) {
if (!object) {
alert('bad or NULL kml');
return;
}
ge.getFeatures().appendChild(object);
var la = ge.createLookAt('');
la.set(45.083248, -93.478760, 25,
ge.ALTITUDE_MODE_RELATIVE_TO_GROUND,
180, 60, 500);
ge.getView().setAbstractView(la);
}

var url = 'http://www.panoramearth.com/kmz/Video.kml';
google.earth.fetchKml(ge, url, finished);
***************************************************************

The result is that the placemark and its balloon are displayed but not
the YouTube video.
Yet, the same Video.kml file displays the video in GE executable.
Is there a solution?

ManoM

unread,
Jun 14, 2008, 7:33:17 PM6/14/08
to KML Developer Support - Google Earth Browser Plugin
Hi dorjee,

Can you post a link to your whole page?

Mano

On Jun 15, 8:25 am, dorjee wrote:
> I'm sorry but I tried I tried... Nothing works for now.
> I made a Video.kml with this code from:
>
> http://code.google.com/apis/kml/documentation/kmlreference.html#sampl...

dorjee

unread,
Jun 15, 2008, 3:23:51 AM6/15/08
to KML Developer Support - Google Earth Browser Plugin
Hi Mano,
if the Google example doesn't work it is already a problem!
But I give you this link to the whole test-page:

http://www.panoramearth.com/index2.html

the placemark is at west of great lakes usa.

you can test this kml too: http://www.panoramearth.com/kmz/Copie-de-panoramearth-hr.kml

the placemarks are in France. This kml is much like the final project.

fraser

unread,
Jun 15, 2008, 5:40:16 AM6/15/08
to KML Developer Support - Google Earth Browser Plugin
Hi,

Yes, I have the exact same probem. I have flv videos embeded in the
placemarks kml decription (as in marquies's post).
This works fine if I view the KML in the GE application but the video
does not show up in the plugin.

Any ideas?

F.
> > Mano- Hide quoted text -
>
> - Show quoted text -

jpwade_bsu

unread,
Jun 15, 2008, 10:46:06 PM6/15/08
to KML Developer Support - Google Earth Browser Plugin
hello marquies,

please post a functional web page as an example

jpwade
www.czmartin.com/jpw
> >http://code.google.com/apis/kml/documentation/kmlreference.html#sampl...- Hide quoted text -

Robert S

unread,
Jun 16, 2008, 7:27:35 AM6/16/08
to KML Developer Support - Google Earth Browser Plugin
On Jun 15, 3:23 am, dorjee wrote:
>
> http://www.panoramearth.com/index2.html

Interesting.... When I look at this in Firebug I see the following for
the balloon div:

<div style="border: 2px solid white; margin: 0px; padding: 0px;
overflow: auto; background-color: rgb(255, 255, 255); z-index: 100;
position: absolute; font-size: small; left: 466px; top: 236px; color:
rgb(0, 0, 0); height: 72px; width: 159px;">
<h3>Chateau de Neuvic</h3>
Video de la cour interieure
<xx id="player" _moz-userdefined="" height="360" width="640"
allowfullscreen="false" quality="high" name="player" src="http://
www.panoramearth.com/swf/mediaplayer.swf"/>
</div>

However, when I look at your KML I see:

<name>Chateau de Neuvic</name>
<description><![CDATA[
Video de la cour interieure
<embed type="application/x-shockwave-flash" src="http://
www.panoramearth.com/swf/mediaplayer.swf" id="player" name="player"
quality="high" allowfullscreen="false"
flashvars="backcolor=0x4096EE&amp;frontcolor=0xffffff&amp;lightcolor=0xCC0000&amp;screencolor=0x000000&amp;file=http://
www.panoramearth1.com/45.103103,0.475021,2008.06.13,12.04/video.flv&amp;autostart=true"
width="640" height="360"></embed>
]]></description>

Assuming I can trust firebug, this leads me to think that the GE
plugin is deliberately munging the embed tag.

ManoM

unread,
Jun 17, 2008, 1:41:12 AM6/17/08
to KML Developer Support - Google Earth Browser Plugin
Sorry, I just got word from one of the engineers that there is a
deliberate block on Flash content in the balloon when loaded using
KML. That is to prevent cross-site scripting attacks. However, if you
create a placemark programmatically, using the API, then you can
include Flash content.

Mano

Robert S

unread,
Jun 18, 2008, 6:57:53 PM6/18/08
to KML Developer Support - Google Earth Browser Plugin
On Jun 17, 1:41 am, ManoM wrote:
> Sorry, I just got word from one of the engineers that there is a
> deliberate block on Flash content in the balloon when loaded using
> KML.

Thanks for confirming that. Good to know that I'm not going insane....

dorjee

unread,
Jun 25, 2008, 3:58:29 AM6/25/08
to KML Developer Support - Google Earth Browser Plugin
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.


ManoM

unread,
Jun 25, 2008, 7:17:05 AM6/25/08
to KML Developer Support - Google Earth Browser Plugin
Hi dorjee,

Could you add that as a feature request?
http://groups.google.com/group/kml-support/web/earth-api-feature-request-page

Mano

fraser

unread,
Jul 14, 2008, 6:10:03 PM7/14/08
to KML Developer Support - Google Earth Browser Plugin
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 -

fraser

unread,
Jul 14, 2008, 8:15:35 PM7/14/08
to KML Developer Support - Google Earth Browser Plugin
Hello,

OK, as promised here is a stripped down example of embedding flash
objects into placemark balloons via loaded KML

Here is the kml file that is being loaded...
http://www.simpsonhaugh.co.uk/SimpsonHaugh/map/flv.kml

Here is a page with a working example...
http://www.simpsonhaugh.co.uk/SimpsonHaugh/map/flvtest.php

Enjoy!

Fraser.
> > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages