Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Auto Youtube Link-Converter Details »»
Auto Youtube Link-Converter
Version: 1.4, by Disasterpiece Disasterpiece is offline
Developer Last Online: Oct 2019 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.1.2 Rating:
Released: 03-31-2011 Last Update: 05-22-2011 Installs: 795
Uses Plugins
Re-useable Code  
No support by the author.

So basically this is a total easy-to-implement plugin, which converts standard youtube links to video-embeds on the fly without urging users to use the video-button because I think it is unnecessary.


On post display, the plugin checks if the post contains at least 1 youtube link in the form of
Code:
<a href="http://www.youtube.com/watch?v=somecode&some=params">http://www.youtube.com/watch?v=somecode&some=params</a>
and converts them using the default vB video bbcode parser.

Code can be modified to fit your needs, altough there shouldn't be much to add.
If you're the special performance-freak, I'm curious if you can enhance data/query-performance. So let me know if you do.

INSTALL:

- Download attached XML File and import it as an addon.

Code:
Changes since 1.3:
- Now works properly on iPad

Changes since 1.2:
- Supports mobile devices with fallback-display if browser doesn't support flash/embed codes
- Allows the user to specify the above mentioned replacement code for mobile browsers
- Minor improvements & Fixes

Changes since 1.1:
- Moved regular expression and index position into admincp settings to allow easier changing in the future
- supports new youtube link format: "http://youtu.be/*somevideocode*"

Changes since 1.0: (or: why should I download that mod again?)
- Added Link parsing in post-preview mode and in post reviewbits (the latest posts you see under the new reply form)

Now every post containing youtube-links should display the embedded video instead.
Works with any number of youtube-links and any kind of text surrounding them.

Let me know if you have trouble/questions.

Download Now

File Type: xml product-autoytparser_1_1.xml (2.7 KB, 365 views)
File Type: xml product-autoytparser_1_2.xml (4.3 KB, 190 views)
File Type: xml product-autoytparser_1_3.xml (7.8 KB, 251 views)
File Type: xml product-autoytparser_1_4.xml (7.8 KB, 3453 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #262  
Old 02-07-2017, 11:28 AM
alexm's Avatar
alexm alexm is offline
 
Join Date: Apr 2005
Location: United Kingdom
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dirkji View Post
Since last week all YouTube embeds show up as black boxes on IE. Chrome and Firefox work fine. Does anyone have an idea what's causing this?
I think it is in the vBulletin template 'bbcode_video' (it's nothing to do with this mod). If you change //www to https://www IE should work. I just did the same to my vBulletin 4.2.3 and looked here first!

edit: Now it doesn't work again

edit2: It's something weird with IE debugger, when I open Developer Tools and then refresh it opens the Youtube fine!
Reply With Quote
  #263  
Old 02-08-2017, 08:51 AM
dirkji dirkji is offline
 
Join Date: Nov 2006
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by alexm View Post
edit2: It's something weird with IE debugger, when I open Developer Tools and then refresh it opens the Youtube fine!
Yes, I noticed that as well.

When I change:

<meta http-equiv="X-UA-Compatible" content="IE=9">

to

<meta http-equiv="X-UA-Compatible" content="IE=Edge">

the videos work fine, but then my image uploader stops functioning.

Any other ideas?
Reply With Quote
  #264  
Old 02-09-2017, 06:57 AM
dirkji dirkji is offline
 
Join Date: Nov 2006
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems to have fixed itself, probably an IE update...
Reply With Quote
  #265  
Old 09-15-2017, 07:55 PM
IggyP IggyP is offline
 
Join Date: May 2012
Posts: 252
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm...noticed ipad mini retina not showing the embeds...any ideas of that? i see in the notes it was meant to be working on at least some form of tablet..

in fact is there a simply all around better version of this? seems like there would be, just didnt see it yet...better to not use flash at all isnt that possible by now?


EDIT:
i removed the flash part of the code....it now loads the embeds into posts....but if you try to play them, it redirects to youtube...anyone know what is the better replace code than this for mobile?

Quote:
<a href="http://www.youtube.com/watch?v=%1$s">
YouTube Video:<br /><img src="http://img.youtube.com/vi/%1$s/0.jpg" width="480" height="360" alt="Click here to view on youtube" /></a>
Reply With Quote
  #266  
Old 09-15-2017, 09:00 PM
IggyP IggyP is offline
 
Join Date: May 2012
Posts: 252
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

got it...

Quote:
<iframe id="ytplayer" type="text/html" width="640" height="360"
src="https://www.youtube.com/embed/%1$s"
frameborder="0"></iframe>
Reply With Quote
Благодарность от:
djbaxter
  #267  
Old 09-15-2017, 10:01 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Posting just for my own clarification the solution from IggyP above...

FIND near line 130 in XML file:

Code:
	<defaultvalue><![CDATA[<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/%1$s" width="480" height="360">

REPLACE with:

Code:
	      <defaultvalue><![CDATA[<iframe id="ytplayer" type="text/html" width="640" height="360"
src="https://www.youtube.com/embed/%1$s" frameborder="0"></iframe>

Note: This sort of works for iPad. However, it leaves a lot of empty white space with a thumbnail and the fallback link to view on Youtube near the bottom of the post.

On iPhone, it just creates a lot of empty white space, although the video is viewable if I switch to desktop or iPad.

Did I do something incorrectly?
Reply With Quote
  #268  
Old 09-15-2017, 11:49 PM
IggyP IggyP is offline
 
Join Date: May 2012
Posts: 252
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

its just a simple code i found as alternate to the flash...i didnt try it by mobile on phone size, but perhaps its the size settings in the code? i wanted to keep it sort of big for "mobile" tablet but of course phones maybe thats a problem? hmm


theres other options that can be added as well of course.. >> https://developers.google.com/youtube/player_parameters


also this quote from the source: which suggests the sizes 240 and 135 instead of what i used..fwiw...

Quote:
Use the iframe-embedded version of the player instead of the Flash one. The embedded version is smart enough to render the appropriate player based on the device (ie, it may render the Flash version for phones like the Android that support it, or the HTML5 version for iPhone).
Quote:
<iframe
width="240" height="135"
src="http://www.youtube.com/embed/videoid"
frameborder="0" allowfullscreen>
</iframe>
EDIT: fwiw, testing with an s5 and ipad mini retina i cannot reproduce, seems to work proper and scale and everything but thats not necessarily saying much

EDIT2: also dont forget this mod has options....so dont really need to hack the xml
Reply With Quote
  #269  
Old 09-16-2017, 10:19 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by IggyP View Post
EDIT2: also dont forget this mod has options....so dont really need to hack the xml
D'oh!

And that explains why it wasn't working for me. When I go to the options, it still has the old Flash code.

Going to try editing that now.
Reply With Quote
  #270  
Old 09-16-2017, 10:52 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And your original fix when I edit it in options works just fine. I tweaked the fallback it just a little for formatting so now the complete contents of the mobile text box in Options looks like this:

Code:
<iframe id="ytplayer" type="text/html" width="640" height="360"
src="https://www.youtube.com/embed/%1$s"
frameborder="0"></iframe>
<param name="movie" value="http://www.youtube.com/v/%1$s" />
<param name="quality" value="high" />
<param name="allowFullScreen" value="true" />
<!-- Fallback content -->
<br /><br/><a href="http://www.youtube.com/watch?v=%1$s">
Click here to watch video on YouTube<br /><br /><img src="http://img.youtube.com/vi/%1$s/0.jpg" width="240" height="180" alt="Click here to view on youtube" /></a>
</object>
Thank you, IggyP, both for the fix and for helping me through my D'Oh! moment.
Reply With Quote
  #271  
Old 05-14-2018, 01:32 PM
alexm's Avatar
alexm alexm is offline
 
Join Date: Apr 2005
Location: United Kingdom
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I?ve got a problem... over the last 2 weeks (maybe longer!) videos appear as a black window if you use IE11. What it appears to be is:

Code:
<meta http-equiv="X-UA-Compatible" content="IE=9" />
in headinclude.

If you remove it Youtube embeds correctly... but unless you have this added then people can?t press enter if they have anything but simple text turned on.

I don?t know whether it is IE?s fault or YouTube?s fault (probably IE )... does anyone else have this problem?

Alex
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:16 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.15928 seconds
  • Memory Usage 2,361KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (14)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (4)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete