Dave Hoefler
2007-Feb-12  16:56 UTC
Converting youtube and google video embed HTML into a SWFObject
Hi there,
Is there a small ruby / rails library that formats youtube or google video
HTML embed code into SWFObject (http://blog.deconcept.com/swfobject/) HTML?
The code youtube and google video provide doesn''t always play nice in
IE
apparently (that''s what one of our CSS gurus at work told me).
So I''m looking to turn this (which doesn''t play nice in all
browsers):
    <object width="425" height="350">
        <param name="movie"
value="http://www.youtube.com/v/qqsyXdj_p_I
"></param>
        <param name="wmode"
value="transparent"></param>
        <embed src="http://www.youtube.com/v/qqsyXdj_p_I"
               type="application/x-shockwave-flash"
               wmode="transparent"
               width="425"
               height="350">
        </embed>
    </object>
into this:
<div id="youtube"></div>
<script type="text/javascript">
    var so = new SWFObject("http://www.youtube.com/v/qqsyXdj_p_I",
"youtube_1", "425", "350",
"6","","","","","");
    so.write("youtube");
</script>
The project I''m working on is a social community and we''re
trying to keep
the comments people post on profile pages as valid as possible.
Thanks,
Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Dave Hoefler
2007-Feb-12  16:57 UTC
Re: Converting youtube and google video embed HTML into a SWFObject
I forgot to mention, the whole site is in Rails... so that''s why I''m asking here :-) On 2/12/07, Dave Hoefler <dhoefler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi there, > > Is there a small ruby / rails library that formats youtube or google video > HTML embed code into SWFObject (http://blog.deconcept.com/swfobject/) > HTML? The code youtube and google video provide doesn''t always play nice in > IE apparently (that''s what one of our CSS gurus at work told me). > > So I''m looking to turn this (which doesn''t play nice in all browsers): > > <object width="425" height="350"> > <param name="movie" value=" http://www.youtube.com/v/qqsyXdj_p_I > "></param> > <param name="wmode" value="transparent"></param> > <embed src=" http://www.youtube.com/v/qqsyXdj_p_I" > type="application/x-shockwave-flash" > wmode="transparent" > width="425" > height="350"> > </embed> > </object> > > into this: > > <div id="youtube"></div> > <script type="text/javascript"> > var so = new SWFObject(" http://www.youtube.com/v/qqsyXdj_p_I", > "youtube_1", "425", "350", "6","","","","",""); > so.write("youtube"); > </script> > > > The project I''m working on is a social community and we''re trying to keep > the comments people post on profile pages as valid as possible. > > Thanks, > Dave >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dave Hoefler
2007-Feb-12  21:34 UTC
Re: Converting youtube and google video embed HTML into a SWFObject
Here''s a little more info on the issue:
Let''s say I have this string that contains 2 <object> links for
embedding
youtube videos amongst some other random text.
string = "We''ve got some junk text here" +
         "<object width=\"425\"
height=\"350\"><param name=\"movie\"
value=\"http://www.youtube.com/v/qqsyXdj_p_I\"></param>"
+
         "<param name=\"wmode\"
value=\"transparent\"></param><embed src=\"
http://www.youtube.com/v/qqsyXdj_p_I\"
type=\"application/x-shockwave-flash\"" +
         "wmode=\"transparent\" width=\"425\"
height=\"350\"></embed></object>" +
         "And we''ve got some more junk text right here" +
         "<object width=\"425\"
height=\"350\"><param name=\"movie\"
value=\"http://www.youtube.com/v/yYqACgndOQA\"></param>"
+
         "<param name=\"wmode\"
value=\"transparent\"></param><embed src=\"
http://www.youtube.com/v/yYqACgndOQA\"
type=\"application/x-shockwave-flash\"" +
         "wmode=\"transparent\" width=\"425\"
height=\"350\"></embed></object>" +
         "more garbage text here"
I''d like to get the value of the ''value'' attributes
("
http://www.youtube.com/v/qqsyXdj_p_I" and "
http://www.youtube.com/v/yYqACgndOQA" respectively) and convert the string
into the following:
We''ve got some junk text here
<div id="youtube_qqsyXdj_p_I"></div>
<script type="text/javascript">
    var so = new SWFObject("http://www.youtube.com/v/qqsyXdj_p_I",
"qqsyXdj_p_I", "425", "350",
"6","","","","","");
    so.write("youtube_qqsyXdj_p_I");
</script>
And we''ve got some more junk text right here
<div id="youtube_yYqACgndOQA"></div>
<script type="text/javascript">
    var so = new SWFObject("http://www.youtube.com/v/yYqACgndOQA",
"yYqACgndOQA", "425", "350",
"6","","","","","");
    so.write("youtube_yYqACgndOQA");
</script>
more garbage text here
What would be the best library to use for parsing and replacing certain
values in a string? I''ve done simple .gsub''ing before, but
this seems to be
a little more complicated ;-)
Thanks,
Dave Hoefler
On 2/12/07, Dave Hoefler
<dhoefler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> I forgot to mention, the whole site is in Rails... so that''s why
I''m
> asking here :-)
>
> On 2/12/07, Dave Hoefler <
dhoefler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > Hi there,
> >
> > Is there a small ruby / rails library that formats youtube or google
> > video HTML embed code into SWFObject (
> > http://blog.deconcept.com/swfobject/) HTML? The code youtube and
google
> > video provide doesn''t always play nice in IE apparently
(that''s what one of
> > our CSS gurus at work told me).
> >
> > So I''m looking to turn this (which doesn''t play nice
in all browsers):
> >
> >     <object width="425" height="350">
> >         <param name="movie" value="
http://www.youtube.com/v/qqsyXdj_p_I
> > "></param>
> >         <param name="wmode"
value="transparent"></param>
> >         <embed src="
http://www.youtube.com/v/qqsyXdj_p_I"
> >                type="application/x-shockwave-flash"
> >                wmode="transparent"
> >                width="425"
> >                height="350">
> >         </embed>
> >     </object>
> >
> > into this:
> >
> > <div id="youtube"></div>
> > <script type="text/javascript">
> >     var so = new SWFObject("
http://www.youtube.com/v/qqsyXdj_p_I",
> > "youtube_1", "425", "350",
"6","","","","","");
> >     so.write("youtube");
> > </script>
> >
> >
> > The project I''m working on is a social community and
we''re trying to
> > keep the comments people post on profile pages as valid as possible.
> >
> > Thanks,
> > Dave
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---