YouTube embedded videos "black bar" picture problem

Get help developing custom BBCodes or request one.
Puntadelanza
Registered User
Posts: 165
Joined: Thu Jul 03, 2003 10:48 am
Location: Spain

Re: YouTube embedded videos "black bar" picture problem

Post by Puntadelanza »

Thanks for your answer DavidIQ.

Providing more information:

phpbb version of my site: 3.1.9
My site: http://www.puntadelanza.net/Foro/phpBB3/

My old BBcode was like that:

Code: Select all

[youtube]http://{TEXT1}youtube.com/watch?v={TEXT2}[/youtube]

Code: Select all

<object width="640" height="385"><param name="movie" value="http://{TEXT1}youtube.com/v/{TEXT2}&version=2"></param><param name="wmode" value="transparent"></param><embed src="http://{TEXT1}youtube.com/v/{TEXT2}&version=2" type="application/x-shockwave-flash" wmode="transparent" width="640" height="385"></embed></object>

I went through ACP and changed my BBcode in the wat that JoshyPHP has posted:

Code: Select all

[youtube]{IDENTIFIER}[/youtube]

Code: Select all

<iframe width="640" height="360" src="https://www.youtube.com/embed/{IDENTIFIER}" frameborder="0" allowfullscreen></iframe>
But It did not work.
Not sure if because, all my videos are linked by http instead of https....
Not sure, but they are not working.
Do you have any clue on that issue?..... It will help a lot.




I was wandering about to attack php_post table in the database, with someting like that:

Code: Select all

UPDATE `phpbb_posts` SET `post_text` = REPLACE(`post_text`, '[youtube]http://www.youtube.com/watch?v=', '[youtube]');
I've try it with two diferent rows, and although the post is properly formated, the video is not showing properly. Is necessary to edit post (without doing anything) and saving, and then it works, but this is not a way to do it.... I have a lot of rows and posts.... no way....


Many thanks
Estrategia, táctica y sobre todo Combat Mission.
Punta de Lanza
phpbb user since 2003
User avatar
JoshyPHP
Code Contributor
Posts: 1291
Joined: Mon Jul 11, 2011 12:28 am

Re: YouTube embedded videos "black bar" picture problem

Post by JoshyPHP »

Changing custom BBCodes is not retroactive. That definition will not work with your old posts because your old BBCode uses multiple different tokens.

You can probably modify your old BBCode to make it work with YouTube's current markup. Note that I do not recommend using this BBCode. The only YouTube BBCode I would recommend is the one you quoted, but that one will not work with your old posts without some manual maintenance.

Code: Select all

[youtube]http://{TEXT1}youtube.com/watch?v={IDENTIFIER}[/youtube]

Code: Select all

<iframe width="640" height="360" src="https://www.youtube.com/embed/{IDENTIFIER}" frameborder="0" allowfullscreen></iframe>
I wrote the library that handles markup in phpBB 3.2+.
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 18490
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón

Re: YouTube embedded videos "black bar" picture problem

Post by DavidIQ »

^ what he said. If you keep your BBCode definition the same and just corrected the replacement then it should work fine retroactively. Otherwise I think you would just use the STK to reparse all posts.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: YouTube embedded videos "black bar" picture problem

Post by 3Di »

DavidIQ wrote:Otherwise I think you would just use the STK to reparse all posts.
STK isn't ready for 3.1.x though and the only reparser of BBcodes that I am aware of - for it - has been not yet relesed to the crowd, still a concept or some thing more.

Edit: sems like the OP posted into the wrong forum?
Puntadelanza wrote:Thanks for your answer DavidIQ.

Providing more information:

phpbb version of my site: 3.1.9
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Puntadelanza
Registered User
Posts: 165
Joined: Thu Jul 03, 2003 10:48 am
Location: Spain

Re: YouTube embedded videos "black bar" picture problem

Post by Puntadelanza »

Thanks for your answers.

I did not keep my old BBCode configuration.
I preferr to update it and figure it how to change all my old posts.
I saw that STK is not release for 3.1.x versions... So I really do not know how to fix my old posts...
3Di wrote: Edit: sems like the OP posted into the wrong forum?
Puntadelanza wrote:Thanks for your answer DavidIQ.

Providing more information:

phpbb version of my site: 3.1.9
I do not understand what do you mean.... Sorry.

Many thanks.
Estrategia, táctica y sobre todo Combat Mission.
Punta de Lanza
phpbb user since 2003
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: YouTube embedded videos "black bar" picture problem

Post by Lumpy Burgertushie »

he means that you posted in the 3.0 support forum and you are running 3.1
the STK does not apply to 3.1 which is what much of this topic is discussing.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 18490
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón

Re: YouTube embedded videos "black bar" picture problem

Post by DavidIQ »

He's fine I think since there is no BBCode support forum for 3.1 as of yet.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
MegaMav
Registered User
Posts: 46
Joined: Sat Sep 08, 2007 2:55 pm

Re: YouTube embedded videos "black bar" picture problem

Post by MegaMav »

You can use my code. I dont mind.
This works with either URL or Share links.
It is updated as a replacement for the Youtube API Problem if you want to keep existing youtube tags that used full urls.

BBCode Usage

Code: Select all

[youtube]{URL}[/youtube]
HTML Replacement

Code: Select all

<script language="Javascript">
var a = '{URL}';
var temp = new Array();
var check = new Array();
check = a.match('//youtu\.be');

if(check)
{
temp = a.split('youtu.be/');
document.write('<iframe width="640" height="360" src="https://www.youtube.com/embed/' + temp[1] + '" frameborder="0" allowfullscreen></iframe>');
}
else
{
temp = a.split('?v=');
document.write('<iframe width="640" height="360" src="https://www.youtube.com/embed/' + temp[1] + '" frameborder="0" allowfullscreen></iframe>');
}
</script>
Help line

Code: Select all

Embeds YouTube Video: [youtube]SHARE LINK OR URL[/youtube]
Enjoy,

-Eric
WWu777
Registered User
Posts: 812
Joined: Tue Aug 14, 2007 12:40 pm

Re: YouTube embedded videos "black bar" picture problem

Post by WWu777 »

Darloup wrote:Thanks JoshyPHP, but your BBCode does not work on my forum. I get this:

Image

as you can check here: http://www.darloup.com/forum/viewtopic.php?f=11&t=2383
The code I'm using works with both http and https. Did you try it? Here it is again:

Field 1:

Code: Select all

[youtube]{TEXT1}youtube.com/watch?v={IDENTIFIER}{TEXT2}[/youtube]
Field 2:

Code: Select all

<iframe width="560" height="315" src="//www.youtube.com/embed/{IDENTIFIER}" frameborder="0" allowfullscreen></iframe>
Hermskii
Registered User
Posts: 73
Joined: Thu May 13, 2004 4:45 am
Location: Houston, TX

Re: YouTube embedded videos "black bar" picture problem

Post by Hermskii »

@ GandalfleGris,

This totally worked for me. Thank you! Both old and new work with no issues.

Thank again!
~Peace~

Hermskii

Return to “Custom BBCode Development and Requests”