Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Suki on December 21, 2011, 03:04:59 PM

Title: Ohara YouTube Embed
Post by: Suki on December 21, 2011, 03:04:59 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=3268)

Ohara YouTube Embed
Author: Suki (http://missallsunday.com)

Attention:
On install make sure to mark the "Install in Other Themes" checkbox.


Description

For SMF 2.0.x only

Version 1.2.x and above requires PHP 5.3 or greater

You can auto-embed any valid youtube, imgur/gifv or vimeo urls and the mod will automatically convert them to videos.

This mod will also add a BBC tag:  [youtube][/youtube], [gifv][/gifv] and [vimeo][/vimeo]  where you can post your youtube or vimeo urls and it will be converted to a video directly in the message.

You can enable/disable the mod as well as set the width and height for the videos, currently the mod support the following youtube and vimeo urls:

Code: [Select]
http://www.youtube.com/watch?v={ID}
http://www.youtube.com/watch?v={ID}&{Parameters}
http://www.m.youtube.com/watch?v={ID}
http://youtu.be/{ID}
http://www.youtube.com/watch?feature=player_embedded&v=[ID]
http://vimeo.com/[ID]
http://vimeo.com/channels/[channel name]/[ID]
http://vimeo.com/group/[ID]
http://vimeo.com/album/[ID]

License

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
 



Settings

- Admin->Configuration->Modifications


Languages

- English/utf8
- Spanish_latin/utf8
- Spanish_es/utf8
- Polish/utf8


Changelog
Code: [Select]
1.2.10 - March 10, 2019
- Add Polish translation, thanks to jsx and FishingManMatt
- Correctly delete language files on uninstall
- Spanish word corrections

1.2.10 - March 12, 2017
- Fix the "/>" appearing on autoembed
- Fix support for gifv
- Add a link to the video if JavaScript is disabled

1.2.8 - Oct 25, 2016
- Improve regex for gifv and youtube urls.
- Pass the ID when using url auto parsing, prevents using another regex to get it.
- Use global scope inside closures.

1.2.7 - Aug 12, 2016,
- Set basedWidth and basedHeight to prevent weird behavior on non responsive themes.

1.2.6 - May 29, 2016,
- Add support for full screen videos.
- Remove multiple calls to this.responsive().
- Check the width and height of parent div before applying changes.

1.2.5 - February 18, 2016,
- Added support for imgur gifv format
- Move the css and js calls to integrate_load_theme hook.

1.2.4 - August 2, 2015,
- Added responsiveness to videos. This will only work on responsive themes.
- Fixed an issue when two or more instances of the same video where posted, none of them would be played.
- Re-wrote the JS code to use prototypes.
- Change the default size values to 480 x 270.

1.2.3 - June 26, 2015,
- Added a minified js file.
- Added support for using the youtube ID as param.
- License change to MPL 2.0.

1.2.2 - April 05, 2015,
- Force loading the oharaEmbed.css file from the default theme.
- Add more options to show video preview images
- Add support for previewing a message
- Improve handling of youtube thumbnails and overall JS improvements.
- Add a setting to enable/disable the autoembed feature. This was suppose to be added a long time ago but dunno why I forgot to do it...
- Missed to check the master setting.

1.2.1 - March 09, 2015,
- Added the option to disable the autoembed feature via $context['ohara_disable'].
- Use closures instead of create_function()
- Change the way youtube videos are displayed, faster pages specially with multiple videos, thanks to Infernuza for the tip.

1.2 - March 05, 2014,
- Added auto-embed feature.
- Add support for old [nobbc][yt][/yt][/nobbc] tags
- Add support for [nobbc][vimeo][/vimeo][/nobbc]

1.1 - April 19, 2013,
- Fix the http/https url issue.
- Fixed the parsing smiles after a video issue.
- Fixed the pass by reference issue.
- Updated the regex to include more valid urls.

1.0.1 - Dic 28, 2011,
-Fix the youtube redirect page error if you use the initial tag alone: [youtube]

1.0 - Sep 25, 2011,
-Initial Release
Title: Re: Ohara YouTube Embed
Post by: WantSome on December 28, 2011, 06:07:24 AM
Hiya!

I love your mod.  Thanks! 

I tested it with great success on my test forum, and then used it on my main forum.  For some reason I've come up with a weird problem.

The first video I embedded using the tags was this one:
http://www.youtube.com/watch?v=wifH74R3yJA 

And now for some reason whenever I go to that thread, I get redirected to youtube.  That is, the topic loads for a second and then redirects to youtube.  From topic view when I click on the topic, it goes to my youtube login page.  When I click 'view the last post' from the topic view, it redirects me to youtube. 

I then thought to access the post from my posts and edit it, but viewing my posts also now directs me to youtube.  What's happening?!

Is there a way I can edit that post without being directed to youtube?  And, is there a way to prevent this from happening again?

Thanks!

(I'm using 2.0.1)

EDIT: 
I think I've fixed it. 

When I was testing it on my forum, it was as part of an announcement to my users about the 'new feature' of being able to embed youtube videos into their posts.  I used [youtube] to illustrate ('youtube' in square brackets) and for some reason this caused the entire thing to redirect everything to youtube.  Weird.

Upon trying to edit the post, the forum page loads for a few seconds before redirecting to youtube.  I used the stop button to make it stop loading, thereby preventing it from forwarding to youtube.  I saw where the prolem lay and edited the [youtube] to exclude the square brackets (except, obviously, where I needed them for the actual video), and that seems to have sorted the problem out.

Is this a bug?
Title: Re: Ohara YouTube Embed
Post by: Suki on December 28, 2011, 10:05:56 AM
How do you used the tag?  can you copy/paste inside the code tag the exactly same code you used.

if you use the tag [youtube][/youtube]   empty then it will show a text string: Not a valid youtube URL


The only thing I see  is the string has a %s  and I should use sprintf() on it, otherwise it will show:

Not a valid youtube URL %s
Title: Re: Ohara YouTube Embed
Post by: WantSome on December 28, 2011, 01:23:15 PM
Thanks for the answer, Suki.

Actually I don't think I explained my solution properly.

In my post, I used the correct [youtube][/youtube] tags around the video link.  But I ALSO used just the word [youtube] in the body of the post.
When I managed to view the post (before it redirected to youtube), it showed a blank box where the video should have been.  This blank box started where the [youtube] was used.

So it looked something like this:

Quote
Announcement concerning [youtube] tags.  You can now use [youtube] tags to embed your youtube videos.
Like this:
[youtube]http://www.youtube.com/watch?v=wifH74R3yJA[/youtube]

The end result was something like this:

Quote
Annoucnement concerning
[BIG BLANK BOX]

When I changed the [youtube] items in the first line of the first example, the big blank box disappeared, and the thread stopped redirecting to youtube, and the video showed as expected.

I hope that's clearer now.  The problem doesn't exist any longer because I took the [youtube] away in the text of my post, and only used the tags around the video link.

So, the only bug that exists now (as far as I can tell and I'm no expert) is if someone uses the exact phrase [youtube] without a link, and without closing the tag with [/youtube], the entire thread will redirect to youtube.
Title: Re: Ohara YouTube Embed
Post by: Suki on December 28, 2011, 02:03:18 PM
Thanks for the report, I'll take a look and release a new version.
Title: Re: Ohara YouTube Embed
Post by: Suki on December 28, 2011, 08:26:56 PM
Found the  issue, open your Sources/OharaYTEmbedphp file, find:

'disabled_content' => '$1',   and after that add:

         'block_level' => true,
         'test' => '(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)[/youtube]'


it should be like this:

Code: [Select]
$codes[] = array(
'tag' => 'youtube',
'type' => 'unparsed_content',
'content' => '$1',
'validate' => create_function('&$tag, &$data, $disabled', '
global $txt;

if (empty($data))
$data = $txt[\'OYTE_unvalid_link\'];

else
{
$data = trim(strtr($data, array(\'<br />\' => \'\')));
$data = OYTE_Main($data);
}
'),
'disabled_content' => '$1',
'block_level' => true,
'test' => '(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)[/youtube]'
);

That should fix the standalone tag.

I'll update the mod with the fix later tonight.
Title: Re: Ohara YouTube Embed
Post by: Suki on December 28, 2011, 08:55:49 PM
New version 1.0.1:

Changelog

1.0.1 - Dic 28, 2011,
-Fix the youtube redirect page error if you use the initial tag alone: [youtube]

1.0 - Sep 25, 2011,
-Initial Release


To update just uninstall the olf verison and install the new one via the Package Manager.
Title: Re: Ohara YouTube Embed
Post by: MaXiForum.cz on December 29, 2011, 08:16:21 AM
Hi,
what is the difference between this?
http://custom.simplemachines.org/mods/index.php?mod=936
:)
Title: Re: Ohara YouTube Embed
Post by: Suki on December 29, 2011, 08:55:32 AM
this one:
written for 2.0.x
Uses hooks, less file edits
Does support the short youtube urls

The other one is marked as "deprecated" and I needed a simple mod for embed youtube videos so I built it.
Title: Re: Ohara YouTube Embed
Post by: Joomlamz on January 01, 2012, 08:12:01 PM
Yes nice work
when Update puty portuguese files
thank you

Title: Re: Ohara YouTube Embed
Post by: Robert. on January 02, 2012, 07:14:54 AM
Awesome mod! :)
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2012, 08:49:13 AM
Thanks.
Title: Re: Ohara YouTube Embed
Post by: Hragged on January 07, 2012, 05:01:32 PM
This is great, thanks! ;D

Noticed a little problem on my forum - whenever I have a smiley after a YouTube video in the same post, the smiley image doesn't appear, just the code for the smiley. They work fine when posted above the video though.

Don't know if this happens on all forums (I'm on 2.0.2, I have a couple of other mods installed and a modified template) but thought I should say anyway, just in case!

Cheers! :D

Edit - tested it here, same issue: http://missallsunday.com/modifications_and_packages/ohara_youtube_embed_52.msg299.html#msg299
Title: Re: Ohara YouTube Embed
Post by: Suki on January 07, 2012, 05:28:51 PM
Thanks for the report, I'll check it out.
Title: Re: Ohara YouTube Embed
Post by: J.G on January 27, 2012, 03:04:46 PM
I keep getting the Invalid URL error.  :-\

Do you know why this is? Brilliant Mod by the way.  :laugh:
Title: Re: Ohara YouTube Embed
Post by: Suki on January 27, 2012, 03:29:12 PM
what's the url you're trying to use?
Title: Re: Ohara YouTube Embed
Post by: J.G on January 27, 2012, 04:08:24 PM
This is the code and URL used.

Code: [Select]
[youtube]http://youtu.be/x1yOGhnmYfI[/youtube]
Title: Re: Ohara YouTube Embed
Post by: Suki on January 27, 2012, 04:13:33 PM
Is that the exact same video url?

Do you post something else besides the video url?
Title: Re: Ohara YouTube Embed
Post by: J.G on January 27, 2012, 04:22:36 PM
Indeed, it is the exact same URL. I will give it a try with other URLs to see if the problem continues.


Code: [Select]
[youtube]http://youtu.be/V3hxPnG0GeE[/youtube]

[youtube]http://youtu.be/JM2PRqR9WeA[/youtube]

[youtube]http://www.youtube.com/watch?v=JM2PRqR9WeA[/youtube]

Now, the first two codes using the new URL format do not work, while the third one using the old style format works fine.
Title: Re: Ohara YouTube Embed
Post by: Suki on January 27, 2012, 04:35:37 PM
mmm, that is weird, I posted the same urls on my site and on my test site and all of them are working:

http://missallsunday.com/chit_chat/some_tests_94.new.html#new
Title: Re: Ohara YouTube Embed
Post by: J.G on January 27, 2012, 04:53:40 PM
How very weird. Why could this be? During the install process, it all went well.  :o :o
Title: Re: Ohara YouTube Embed
Post by: Suki on January 27, 2012, 04:56:46 PM
Are you using the latest version?

Maybe there is some kind of restriction for those videos from youtube or you have other mods that modifies urls before this mod and that is causing the regex to fail.


Other than that I'm afraid I have no idea.
Title: Re: Ohara YouTube Embed
Post by: J.G on January 27, 2012, 06:34:31 PM
Indeed. I downloaded the latest version earlier today. I presume this to be the one currently available in the download page, right?

I know I downloaded and installed the earlier version some weeks ago, and before uploading the new version I did ensure to remove the old. Could this perhaps be the problem?
Title: Re: Ohara YouTube Embed
Post by: J.G on January 27, 2012, 06:45:34 PM
I installed it on the live forum and it works!  ;D ;D Thanks for your help. Great mod!!!
Title: Re: Ohara YouTube Embed
Post by: discutemexico on February 06, 2012, 03:05:41 PM
Hello. I am new to this and I have a big problem with your mod. I followed all the steps but videos are not shown in the messages. Instead, I see the bbc youtube tag as part of the message. Any help would be appreciated. Thanks a lot.
Title: Re: Ohara YouTube Embed
Post by: discutemexico on February 06, 2012, 03:14:39 PM
Maybe my message was not clear. I installed the mod, I activated the mod and then, when I use the tag in a message, I get this: (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.discutemexico.com%2Fyoutubetag.jpg&hash=d7cf2409b59de9b9c9a4877ef907b519)

Thanks a lot!
Title: Re: Ohara YouTube Embed
Post by: Suki on February 07, 2012, 10:25:58 AM
@discutemexico  url?  SMF version?

I cannot help if you don't provide enough info...
Title: Re: Ohara YouTube Embed
Post by: Fed Drago on February 10, 2012, 03:31:11 AM
Installed this Mode and it works like a charm thank you for your hard work on it...

Cheers

Fed
Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 03:59:59 PM
Hi

I have a little problem, when i install this mod i get a gap at the top of the forum, see pic attached. Any one know how i can remove it?
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 04:36:03 PM
url to your forum or url to a topic using this mod?

that image doesn't say much.

Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 04:37:47 PM
It only happens when i go in to a pasting, any posting.

http://ogforum.co.uk/index.php?topic=2842.0
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 04:39:32 PM
pasting?


I see no youtube video on that topic.


Can you please be as specific as you can.
Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 04:51:59 PM
OK. that's my bad, misspelling, the post before was meant to say "It only happens when i go in to a posting, any posting."

When i install the mod it doesn't matter if there is a youtube video on the posting or not it just adds a gap right at the top of the forum on any posting, if i go out of the posting for the home page then the gap disappears.

http://ogforum.co.uk - Home page (No Gap)
http://ogforum.co.uk/index.php?board=1.0 - Random Topic  (No Gap)
http://ogforum.co.uk/index.php?topic=2842.0  - Random posting (Gap at the top of the forum)
http://ogforum.co.uk/index.php?topic=2547.msg34671#msg34671 - Posting with youtube on it (Gap at the top of the forum)
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 04:56:22 PM
I see no gap and this mod shouldn't interfere with your theme since this mod doesn't edit any template, all is made via hooks and the only edits this mod does have nothing to do with any template.


does it happens on the default theme?
does it happens to all users?
does it happens with all browsers?
any errors on your error log?
Does it happens if you uninstall the mod?


Can I have a regular user account to test this further.
Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 05:02:54 PM
It happens with all the users, and the default theme. If i uninstall the mod then the gap disappears. I have tried with firebox and safari and i get the same thing.
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 05:04:36 PM

Can I have a regular user account to test this further.
Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 05:08:51 PM
Yep use user: OGBot password: Og12345678
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 05:46:33 PM
It's a weird error indeed, the browser adds the space at the top, causing the whole wrapper div to be misplaced by 15 ~ 20 px,  I believe it has to do with the encoding in OharaYTEmbed.php file but I'm not sure about it since if that was the case, the space would appear in every page.

Attach your Sources/OharaYTEmbed.php file here.
Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 05:51:55 PM
OK here it is
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 05:58:30 PM
mmm, ok, that file is normal, but some other file is on UTF8 and it's causing that space, what language are you using?

Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 06:07:26 PM
I'm using english UTF8. do you want me attach it here for you to have a look?
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 06:09:33 PM
Sure or if you have a code editor, make sure that file is properly encoded as UTF8 without BOM.
Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 06:12:30 PM
here it is what i'm using, the file is named "OharaYTEmbed.english_british-utf8.php"

Code: [Select]
<?php

global $txt;

$txt['OYTE_master'] = 'Enable the Ohara Youtube Embed mod';
$txt['OYTE_master_sub'] = 'This is the master setting, it needs to be enable for the mod to work.';
$txt['OYTE_video_width'] = 'Video\'s width:';
$txt['OYTE_video_width_sub'] = 'If empty it will take the default value: 420.';
$txt['OYTE_video_height'] = 'Video\'s height:';
$txt['OYTE_video_height_sub'] = 'If empty it will take the default value: 315';
$txt['OYTE_desc'] = 'Embed a youtube video url';
$txt['OYTE_unvalid_link'] = 'Not a valid youtube URL %s';
$txt['OYTE_title'] = 'Ohara Youtube Embed mod';
?>
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 06:16:49 PM
Oh, I was expecting the whole file as an attachment, but nevermind, use this one and see if the space disappear:

rename it to OharaYTEmbed.english_british-utf8.php
Title: Re: Ohara YouTube Embed
Post by: projectmyst on February 14, 2012, 06:33:43 PM
OK i have worked out why its not working, when it copys the files to its places, i.e. OharaYTEmbed, OharaYTEmbed.english_british-utf8.php and so on, it's making the file permission to 666 instead of 644, as soon as i change it to 644 then it works just fine....
Title: Re: Ohara YouTube Embed
Post by: Suki on February 14, 2012, 06:41:58 PM
Weird but it can happen, yes, you can have the file at 644 with no issues if that works for you.
Title: Re: Ohara YouTube Embed
Post by: MadTogger on February 18, 2012, 05:14:32 AM
Hi Suki,

I would dearly love to use your youtube mod but cannot get it to work.

I have installed it manually as per the directions on the mod's page as I have done a number of times with other mods.

The first thing that is noticable is that the 'youtube' button does not appear on the editor.

I have checked to see if the actual bbcode tag works in a post by typing it in manually, it does not.

There is no settings menu in Admin->Configuration->Modifications.

I have also noticed that if I now click my 'Admin' button on the top menu of my forum, the one that goes to url /index.php?action=admin

It just causes a blank page to appear and my forum has gone.

I can get to my Admin CP by clicking any of the sub-menus under Admin, they work fine.

Once in my Admin CP if I then click 'Main>Administration Center', I get the same blank page.

Have you any ideas what the issue could be?

Kind regards..,

Title: Re: Ohara YouTube Embed
Post by: Suki on February 18, 2012, 08:08:21 AM
What SMF version are you using?
Why didn't you use the packager manager?

If you installed manually you must run the install script for the hooks to be inserted on the DB
Title: Re: Ohara YouTube Embed
Post by: MadTogger on February 18, 2012, 08:43:24 AM
What SMF version are you using?
Why didn't you use the packager manager?

If you installed manually you must run the install script for the hooks to be inserted on the DB

Hi,

I am using 2.0.2.

I have a lot of problems installing mods using the package manager, it keeps saying that the directory is not writable when it actually is.

Sometimes I can get around this issue by creating a directory called 'temp' inside the 'Packages' directory and making that writable.

This fix doesn't always work so I tend then to just manually install mods.

I applied my temp folder fix and yes it actually did install your youtube mod perfectly, thank you for the help.

By the way, in the who.php file there is a piece of code:
Code: [Select]
OYTE_Who(),
and this is called from OharaYTEmbed.php as:
Code: [Select]
/* DUH! WINNING! */
function OYTE_Who()
{
$MAS = '<a href="http://missallsunday.com" title="Free SMF Mods">Ohara YouTube Embed mod &copy Suki</a>';

return $MAS;
}

I assume this is your copyright but when and where is actually displayed on my forum?

Kind regards..,

MT
Title: Re: Ohara YouTube Embed
Post by: Suki on February 18, 2012, 08:48:34 AM
The copyright is displayed on the credits action:

http://www.simplemachines.org/community/index.php?action=credits

http://missallsunday.com/credits/

You need to manually run the install file to apply the hooks, download the mod, unzip it, upload the database.php file to your forum root folder (where SSI.php is)  and call it with your browser:  mysite.com/forum/database.php
Title: Re: Ohara YouTube Embed
Post by: MadTogger on February 18, 2012, 08:56:29 AM
The copyright is displayed on the credits action:

http://www.simplemachines.org/community/index.php?action=credits

http://missallsunday.com/credits/

You need to manually run the install file to apply the hooks, download the mod, unzip it, upload the database.php file to your forum root folder (where SSI.php is)  and call it with your browser:  mysite.com/forum/database.php

Thank you so much for all your help Suki, I have got it working now along with your FAQ mod.

You are an angel.

Have a great day.

Hasta Luego  ;D
Title: Re: Ohara YouTube Embed
Post by: leeman on March 17, 2012, 01:39:09 PM
I have installed the Mod, used the tags, but all it does is place the tags before and after the URL link. Does not embed. Any idea why?
Title: Re: Ohara YouTube Embed
Post by: Suki on March 17, 2012, 02:06:28 PM
I have installed the Mod, used the tags, but all it does is place the tags before and after the URL link. Does not embed. Any idea why?

What is your forum version?

Did you installed it via the Package Manager (http://wiki.simplemachines.org/smf/Packages) ?
Title: Re: Ohara YouTube Embed
Post by: leeman on March 17, 2012, 04:23:58 PM
Version 2.0.2

Yes, I used the Package Manager. Funny, I can't embed Flash either. Just shows the tags & the URL

Example:

To me, this stuff is beautiful.  This is one step up from the bottom of the lake's food chain (the bottom would need a microscope to see), and the stuff that feeds everything else in the lake.  When you see these things under a microscope, with their intricate detail, they're as beautiful as any living thing we see with the unaided eye ... to me anyway.


[youtube]http://www.youtube.com/watch?v=09KN6bThy9I[/youtube]
Title: Re: Ohara YouTube Embed
Post by: Suki on March 17, 2012, 04:32:06 PM
What's your forum url?
Title: Re: Ohara YouTube Embed
Post by: leeman on March 18, 2012, 01:19:15 PM
Never mind, it appears to be working now for some reason... Go figure! Thanks anyway...
Title: Re: Ohara YouTube Embed
Post by: Abnovitas on April 04, 2012, 03:32:33 PM
Hi and thanks for your mod!

I've got a (maybe related) issue as well:
I'm using the WYSIWYG editor for message composing and when I paste a Youtube link into the textbox it gets converted to a link automatically.
So when I now use the Youtube BBC tags it won't work and I get a link like this:

[youtube]h++p://www.youtube.com/watch?v=in6RZzdGki8&feature=related[/youtube]

Only when I remove the URL formatting it will work and embed the actual video.
Is there any workaround for this?

Thanks a lot in advance!
Title: Re: Ohara YouTube Embed
Post by: Benelton182 on April 05, 2012, 07:12:28 AM
This is great, thanks! ;D

Noticed a little problem on my forum - whenever I have a smiley after a YouTube video in the same post, the smiley image doesn't appear, just the code for the smiley. They work fine when posted above the video though.

Don't know if this happens on all forums (I'm on 2.0.2, I have a couple of other mods installed and a modified template) but thought I should say anyway, just in case!

Cheers! :D


Hi I have the same problem using the defualt theme and smileys pack. I'm not getting the smileys apperaing only the code after the youtube clip.

TIA
Title: Re: Ohara YouTube Embed
Post by: Suki on April 05, 2012, 01:33:37 PM
@Benelton182 and Abnovitas

I'm aware of both issues, unfortunately I haven't had the time to actually do some research and find the problem.
Title: Re: Ohara YouTube Embed
Post by: simon36 on April 16, 2012, 06:30:55 PM
Hi, great mod.

When I use it, the clip appears in the centre of the post as opposed to align left?

Is this an option I can specify anywhere?

Thanks!
Title: Re: Ohara YouTube Embed
Post by: Suki on April 16, 2012, 08:29:28 PM
No, currently there is no setting for that, if you want to align the video to the left, open  your /Sources/OharaYTEmbed.php file, find: style="text-align:center;margin:auto; and change that to your own css.
Title: Re: Ohara YouTube Embed
Post by: simon36 on April 17, 2012, 08:54:48 AM
Thanks Suki, I edited the file and it displays the way I want it to now.
Title: Re: Ohara YouTube Embed
Post by: katoon123 on May 17, 2012, 12:07:52 PM
Any way you can get this to have a popup box to add youtube link and to work when Toggle View is on ; )
Title: Re: Ohara YouTube Embed
Post by: natas on May 25, 2012, 05:29:09 PM
excuse my ignorance, but where you say edit ./Sources/Post.php you say find <img> and there are actually two instances of that in the file. do both?

also

database.php
This file should be able to execute standalone.


this seems unclear to me because there are no instructions to upload that file or to do anything with it at all except make sure it is able to execute standalone?

any help would be appreciated.

thanks.
Title: Re: Ohara YouTube Embed
Post by: Suki on May 26, 2012, 08:15:07 AM
Welcome to SMF.

Yes, replace the 2 instance of <img>

If you are installing this manually then upload the database.php file to your forlder root and call it with your browser:  mysite.com/forum/database.php

For istalling mods it is always better to use the Package Manager (http://wiki.simplemachines.org/smf/Packages)
Title: Re: Ohara YouTube Embed
Post by: natas on May 26, 2012, 11:46:49 AM
Thanks for the reply and thanks for the mod.
Title: Re: Ohara YouTube Embed
Post by: Grimster on June 18, 2012, 09:01:05 AM
Thanks for a great mod Suki  ;D
Title: Re: Ohara YouTube Embed
Post by: dzoni22 on July 12, 2012, 06:20:19 PM
I have a problem with smiles after youtbe video, too.

Everything is OK before video but after video forum shows me a code instead of smiley.
After second youtube video show smiley again, no code.  ???
Title: Re: Ohara YouTube Embed
Post by: Suki on July 13, 2012, 10:15:50 AM
It's been reported before, don't have the time right now to check/fix, must be something in the bbc and/or how is presented.
Title: Re: Ohara YouTube Embed
Post by: Forces of Steel on August 20, 2012, 10:45:19 PM
Uhh I downloaded this package, the latest version, from the mod site and then uploaded to my forum which uses SMF 2.0.2, and the mod doesn't work. The button to insert a video doesn't appear, and the BB code also doesn't function at all. Did I miss something? I installed it via the package manager upload feature.
Title: Re: Ohara YouTube Embed
Post by: BigMike on August 31, 2012, 02:39:42 PM
Hello SMF,

Suki, thank you for this nice mod. I've been using it now since earlier this year. I've been wanting the videos to display similar to a vBulletin format, so I made some changes including listing the video's Title and link to watch on YouTube if the user so desires.

Here are the changes I made:

File: OharaYTEmbed.php & function OYTE_Replace()

Original lines 131-139:
Code: [Select]
$height = empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height'];

/* Return the HTML  */
$return = '
<div style="text-align:center;margin:auto;padding:5px;" class="youtube '.$string.'">
<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$string.'" frameborder="0"></iframe>
</div>';

return $return;

New lines starting from the same line 131 and ending with the same return statement. I added notes to show what is going on:
Code: [Select]
$height = empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height'];

    // This grabs the video info
    $videoinfo = file_get_contents("http://www.youtube.com/oembed?url=http%3A//youtube.com/watch%3Fv%3D".$string."&format=json");
    // Position where the Video's Title begins
    $pos_start = 10 + strpos($videoinfo, '"title": "');
    // Position where the Video's Title ends
    $pos_end = strpos($videoinfo, '", "html":');
    // The length of the Title
    $pos_length = $pos_end - $pos_start; 
    // Pulls only the Title from the video info
    $video_title = substr($videoinfo, $pos_start, $pos_length);
    // Trim the Title if it is longer than 50 characters
    if ($pos_length > 50)
      $video_title = substr($video_title,0,50) . '...';

    // I am using the old display method that includes the video controls. Replace the <object></object> bit with the newer YouTube iFrame method if desired   
    // I set the title's link to open in a new tab. This is not how vB does it, but I prefer it this way.
    $return = '
<span>
  <div style="text-align: center;">
    <table width="' . $width . '" cellspacing="2" cellpadding="0" align="center" style="margin: auto; border: 1px solid #9999AA;">
      <tbody>
        <tr>
          <td width="' . $width . '"><h3 class="catbg" style="font-weight: normal;"><a href="http://www.youtube.com/watch?v=' . $string . '" target="_blank">YouTube - ' . $video_title . '</a></h3></td>
        </tr>
        <tr height="400">
          <td style="background: none repeat scroll 0 0 #000000; line-height: 0;">
            <object width="' . $width . '" height="' . $height . '">
              <param name="movie" value="http://www.youtube.com/v/' . $string . '&rel=0&hl=en_US&feature=player_embedded&version=1"></param>
              <param name="allowFullScreen" value="true"></param>
              <param name="allowScriptAccess" value="always"></param>
              <embed src="http://www.youtube.com/v/' . $string . '&rel=0&hl=en_US&feature=player_embedded&version=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="' . $width . '" height="' . $height . '"></embed>
            </object>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</span>';

return $return;

Notes:

Here are some screen shots. Click for full size image...

Original method:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi704.photobucket.com%2Falbums%2Fww46%2Frakudasama%2FMCI%2Fth_yt-old.gif&hash=0681e30e0b62148cd670ebc8b84febae) (http://i704.photobucket.com/albums/ww46/rakudasama/MCI/yt-old.gif)         
New method:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi704.photobucket.com%2Falbums%2Fww46%2Frakudasama%2FMCI%2Fth_yt-new.gif&hash=245809ae717f9cad63de35768f39cc28) (http://i704.photobucket.com/albums/ww46/rakudasama/MCI/yt-new.gif)

...and a link to the new method to see it in action:
http://board.marlincrawler.com/index.php?topic=6532.msg1024256#msg1024256

If someone out there has been trying to get the Video's Title to display then I hope this helps!

Thanks again for this awesome mod!! :D :D

Regards,
BigMike
Title: Re: Ohara YouTube Embed
Post by: Suki on August 31, 2012, 02:56:51 PM
YouTube has an API where you can get all info from a video, you just need to pass the video ID, I wanted to include that API on this mod but unfortunately I haven't had the time to do so.
Title: Re: Ohara YouTube Embed
Post by: BigMike on August 31, 2012, 11:52:52 PM
YouTube has an API where you can get all info from a video, you just need to pass the video ID, I wanted to include that API on this mod but unfortunately I haven't had the time to do so.
[ace ventura]Ohhh reeeheeeeeheeeeheeeeaaaaaaalllllllllllllllly[/ace ventura]

I figured they did so I searched Google for it but only came up with a bunch of wget and server options, so I went with the file_get_contents() method and then did the dirty work. The API would have made this so simple I probably wouldn't have posted up my How-To :-|

Thanks again for the mod, we really like it! Another step would be to parse different YT parameters such as if a "feature=related" is placed in front of the video ID, at least on my site this brakes the pattern matching.

Keep it up!!

Regards,
BigMike
Title: Re: Ohara YouTube Embed
Post by: Suki on September 02, 2012, 09:36:39 PM
Is not that difficult to implement and its actually far more easy to manipulate than fetching a whole webpage. The API does provide a lot of info, including the video title.

If I have the time I would change this so every video doesn't get loaded within the page but just show the link or the image preview, when click it, load the video.
Title: Re: Ohara YouTube Embed
Post by: Kurogane on September 12, 2012, 04:35:16 PM
I've a problem with this mod everything is working but some reason i can't see the youtube image in the editor.
Title: Re: Ohara YouTube Embed
Post by: Suki on September 12, 2012, 05:17:01 PM
uninstall it and then install it again, when installing, scroll down and click on the "install on other themes"  checkbox.
Title: Re: Ohara YouTube Embed
Post by: Kurogane on September 12, 2012, 05:35:16 PM
Already did multiple times and still not working in my other template or default theme.
Title: Re: Ohara YouTube Embed
Post by: Suki on September 12, 2012, 05:39:57 PM
Make sure the youtube.gif image is already stored on your  Themes/your_theme/images/bbc/ directory


where your_theme is the actual name of the theme you are using.
Title: Re: Ohara YouTube Embed
Post by: Kurogane on September 12, 2012, 06:26:59 PM
Is not the image mark not found if not the fuction is not added subs.php.

Here screenshot

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FnzKZN.png&hash=64e6604e77d2211fb0816ded24841847)
Title: Re: Ohara YouTube Embed
Post by: Suki on September 12, 2012, 06:34:12 PM
The mod doesn't modify Subs.php at all, the mod sues it's own file: OharaYTEmbed.php

Make sure the following code is presented on that file:

Code: [Select]
/* The bbc button */
function OYTE_bbc_add_button($buttons)
{
global $txt, $modSettings;

loadLanguage('OharaYTEmbed');

if (empty($modSettings['OYTE_master']))
return;

$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
}

If there is, try to change this:

function OYTE_bbc_add_button($buttons)

with this:

function OYTE_bbc_add_button(&$buttons)
Title: Re: Ohara YouTube Embed
Post by: Kurogane on September 12, 2012, 07:22:48 PM
With Ampersand solved the problem.

Thanks  :)
Title: Re: Ohara YouTube Embed
Post by: FemR on October 20, 2012, 07:07:13 PM
Just installed on pretty much vanilla 2.0.2, seems to work great. Simple, easy to use. Thank you!
Title: Re: Ohara YouTube Embed
Post by: BigMike on October 24, 2012, 11:25:46 AM
Ok, updated my video title retrieval code with a more simple approach using an XML object that takes 2 less lines:

Code: [Select]
    $doc = new DOMDocument;
    $doc->load("http://gdata.youtube.com/feeds/api/videos/" . $string);
    $video_title = $doc->getElementsByTagName("title")->item(0)->nodeValue;

Example data from each method...

The former file_get_contents() method:
Code: [Select]
{
"provider_url": "http:\/\/www.youtube.com\/"
"thumbnail_url": "http:\/\/i1.ytimg.com\/vi\/8mrFkpYKJ6Q\/hqdefault.jpg"
"title": "BigMike's 511:1 Marlin Crawler Parking Stall Burn Out"
"html": "\u003ciframe width=\"480\" height=\"270\" src=\"http:\/\/www.youtube.com\/embed\/8mrFkpYKJ6Q?fs=1\u0026feature=oembed\" frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e"
"author_name": "MarlinCrawlerMedia"
"height": 270, "thumbnail_width": 480, "width": 480, "version": "1.0"
"author_url": "http:\/\/www.youtube.com\/user\/MarlinCrawlerMedia"
"provider_name": "YouTube"
"type": "video"
"thumbnail_height": 360
}

The new DOMdocument method:
Code: [Select]
SimpleXMLElement Object
(
    [id] => http://gdata.youtube.com/feeds/api/videos/8mrFkpYKJ6Q
    [published] => 2012-05-02T01:04:14.000Z
    [updated] => 2012-08-01T03:14:03.000Z
    [category] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [scheme] => http://schemas.google.com/g/2005#kind
                            [term] => http://gdata.youtube.com/schemas/2007#video
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [scheme] => http://gdata.youtube.com/schemas/2007/categories.cat
                            [term] => People
                            [label] => People & Blogs
                        )

                )

        )

    [title] => BigMike's 511:1 Marlin Crawler Parking Stall Burn Out
    [content] => Our customer Rick Crarey from Canada and Marlin got to check out BigMike's Crawler doing a 511:1 parking stall burn out. The engine is idling at 800 rpm. Triple Marlin Crawler Ultimate Setup
    [link] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => alternate
                            [type] => text/html
                            [href] => http://www.youtube.com/watch?v=8mrFkpYKJ6Q&feature=youtube_gdata
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => http://gdata.youtube.com/schemas/2007#video.responses
                            [type] => application/atom+xml
                            [href] => http://gdata.youtube.com/feeds/api/videos/8mrFkpYKJ6Q/responses
                        )

                )

            [2] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => http://gdata.youtube.com/schemas/2007#video.related
                            [type] => application/atom+xml
                            [href] => http://gdata.youtube.com/feeds/api/videos/8mrFkpYKJ6Q/related
                        )

                )

            [3] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => http://gdata.youtube.com/schemas/2007#mobile
                            [type] => text/html
                            [href] => http://m.youtube.com/details?v=8mrFkpYKJ6Q
                        )

                )

            [4] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => self
                            [type] => application/atom+xml
                            [href] => http://gdata.youtube.com/feeds/api/videos/8mrFkpYKJ6Q
                        )

                )

        )

    [author] => SimpleXMLElement Object
        (
            [name] => MarlinCrawlerMedia
            [uri] => http://gdata.youtube.com/feeds/api/users/MarlinCrawlerMedia
        )

)

I'm not sure which method is best yet. The DOM method "feels" like it loads faster, but test results prove otherwise.
The former method stores more than 5 times less variable data (621 bytes vs 3,475 bytes)...

Speed test using Firebug, average from 3 tests, loading a forum page with 20 videos:
file_get_contents() method: 12.77 seconds, page size 838.8 kb, 106 requests.
DOMdocument method: 13.82 seconds, size 849.2 kb, 104 requests.

Not sure why the average requests are different, must have something to do with caching.

Anyway, both methods are still slower than whatever vBulletin is doing....

BigMike
Title: Re: Ohara YouTube Embed
Post by: pspmichael on November 14, 2012, 02:20:04 PM
I installed this mod on my SMF 2.02 new installation using the package manager.  Everything reported going just fine.  It then it asked if I wanted it installed on my other themes.  I selected all themes I have and installed.  Again it reported everything was fine.  I have no button for adding any videos.  I tried to input the command by hand to see if it would work.  It did not. 
Any suggestions?
Title: Re: Ohara YouTube Embed
Post by: Suki on November 14, 2012, 02:29:20 PM
The other themes  setting is just to copy the appropiate you tube image to your custom theme BBC images folder.

Try running again the database file, get the mod, unzip it, find the database.php file, upload it to your forum root folder (where SSI.php is)  and call it with your browser:  myforum.com/database.php

Then make sure you have the appropriate calls to the relevant hooks on your DB, go to phpmyadmin or similar, then your DB then your settings table, you must have  some rows with the following values:

   'integrate_bbc_codes' => 'OYTE_bbc_add_code',
   'integrate_bbc_buttons' => 'OYTE_bbc_add_button',
   'integrate_pre_include' => '$sourcedir/OharaYTEmbed.php',
   'integrate_general_mod_settings' => 'OYTE_settings',
Title: Re: Ohara YouTube Embed
Post by: pspmichael on November 14, 2012, 04:05:47 PM
I am not a coder so I don't understand some of the things you mentioned.  I tried uninstalling then reinstalling.  Then I copied the database to the root as you suggested and tried to access it as you instructed.  I'm not sure if it actually did anything or not.
 
I set my SMF BB back to the original theme hoping that would help, no change. 

That makes me wonder if I have something wrong in my installation or does the mod package not work properly with the SMF 2.02?  I took the defaults on everything in my installation.
Title: Re: Ohara YouTube Embed
Post by: Suki on November 14, 2012, 05:27:42 PM
try to change this:

function OYTE_bbc_add_button($buttons)

with this:

function OYTE_bbc_add_button(&$buttons)
Title: Re: Ohara YouTube Embed
Post by: pspmichael on November 14, 2012, 08:18:06 PM
I really hate being a pest, but which file would I find that statement to make the change?
Title: Re: Ohara YouTube Embed
Post by: Suki on November 14, 2012, 09:32:23 PM
Oh, my bad, I deleted the part in the quoted message where I said which file, the file its located at Sources/OharaYTEmbed.php
Title: Re: Ohara YouTube Embed
Post by: CBG on December 07, 2012, 12:58:18 PM
Hi,

How can I add it to support https and http Youtube addresses?

Thanks
Title: Re: Ohara YouTube Embed
Post by: Suki on December 07, 2012, 01:09:50 PM
Open Sources/OharaYTEmbed.php  and find:

Code: [Select]
(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

There are 2 instances of this string, make the change to both.

and replace with this:

Code: [Select]
((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

Back up the file first before doing the change as I haven't tested this change.
Title: Re: Ohara YouTube Embed
Post by: Sapozhnik on January 04, 2013, 06:10:45 PM
The type of link with Parameters _http://www.youtube.com/watch?v=YFpZ6P6Uv3I&feature=youtu.be doesn't work.  >:( Can you help?
Title: Re: Ohara YouTube Embed
Post by: Suki on January 05, 2013, 10:25:18 AM
I actually built the craziest regex I ever wrote for this mod, to support nearly all youtube links, unfortunately, it is lost and I need to start all over again, keep an eye on my site as thats where I will post all future versions.
Title: Re: Ohara YouTube Embed
Post by: BigMike on January 10, 2013, 11:34:22 AM
Ok, updated my video title retrieval code with a more simple approach using an XML object that takes 2 less lines:

Code: [Select]
    $doc = new DOMDocument;
    $doc->load("http://gdata.youtube.com/feeds/api/videos/" . $string);
    $video_title = $doc->getElementsByTagName("title")->item(0)->nodeValue;

After doing some more performance tests, I've concluded that the json method is best, so I've switched back and updated my original code that now only uses ONE line:

Code: [Select]
$video = json_decode(file_get_contents("http://www.youtube.com/oembed?url=http%3A//youtube.com/watch%3Fv%3D".$string."&format=json"), TRUE);
Now just simply use
Code: [Select]
$video['title'] to print out the video's title.

Enjoy
BigMike
Title: Re: Ohara YouTube Embed
Post by: BigMike on January 10, 2013, 11:43:53 AM
Other available array data that is 100% ready to use is, for example,

Code: [Select]
Array
(
    [provider_name] => YouTube
    [width] => 459
    [title] => John drives BigMike's Truck at 511:1 Crawl Ratio
    [author_url] => http://www.youtube.com/user/Husoku
    [version] => 1.0
    [thumbnail_height] => 360
    [provider_url] => http://www.youtube.com/
    [thumbnail_url] => http://i3.ytimg.com/vi/6LoQTme51tA/hqdefault.jpg
    [thumbnail_width] => 480
    [type] => video
    [html] => ****this is the full ready-to-use embed code here****
    [height] => 344
    [author_name] => Husoku
)

BigMike
Title: Re: Ohara YouTube Embed
Post by: cerberusenator on February 06, 2013, 05:57:53 PM
Open Sources/OharaYTEmbed.php  and find:

Code: [Select]
(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

There are 2 instances of this string, make the change to both.

and replace with this:

Code: [Select]
((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

Back up the file first before doing the change as I haven't tested this change.

That isn't working...  :'( please help
Title: Re: Ohara YouTube Embed
Post by: Suki on February 07, 2013, 09:08:51 AM
Just change that part with another regex, there are literally thousands of examples of how to get a youtube url, pick one and follow the instructions.
Title: Re: Ohara YouTube Embed
Post by: BGH on February 17, 2013, 03:28:13 PM
Is it possible to insert a playlist? I ask because I tried it, in the post preview, but it doesn't seem to do the trick.

I wrote something, then inserted the following:

Code: [Select]
[youtube]http://www.youtube.com/watch?v=44NFSbjjGl4&list=PLWxJthc4qU_ZF7xNDwcrbQtxlVe3SzKDQ[/youtube]
And it only inserted the first video from the list.

And I thought that it was possible to embed the playlist since I posted something like you mention in your first post:

Code: [Select]
http://www.youtube.com/watch?v={ID}&{Parameters}

Is not a big issue though, but wanted to know if it's possible to use it for playlists.

Thank you for this mod, Suki :)
Title: Re: Ohara YouTube Embed
Post by: Suki on February 17, 2013, 04:28:11 PM
No, it is not possible to insert playlists, the mod simply wasn't designed for that, its just a very simple BBC mod for showing videos.
Title: Re: Ohara YouTube Embed
Post by: BGH on February 17, 2013, 04:46:58 PM
Ok, thank you Suki. :)
Title: Re: Ohara YouTube Embed
Post by: Maniaka on February 20, 2013, 07:10:37 AM
Hello you need add tag for:

https://www....
Title: Re: Ohara YouTube Embed
Post by: phantomm on February 20, 2013, 07:24:13 AM
@up,
Open Sources/OharaYTEmbed.php  and find:

Code: [Select]
(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

There are 2 instances of this string, make the change to both.

and replace with this:

Code: [Select]
((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

Back up the file first before doing the change as I haven't tested this change.
Title: Re: Ohara YouTube Embed
Post by: akc42 on February 23, 2013, 04:45:19 AM
The mod doesn't modify Subs.php at all, the mod sues it's own file: OharaYTEmbed.php

Make sure the following code is presented on that file:

Code: [Select]
/* The bbc button */
function OYTE_bbc_add_button($buttons)
{
global $txt, $modSettings;

loadLanguage('OharaYTEmbed');

if (empty($modSettings['OYTE_master']))
return;

$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
}

If there is, try to change this:

function OYTE_bbc_add_button($buttons)

with this:

function OYTE_bbc_add_button(&$buttons)

I've just run over this bug having just today downloaded the latest release of this this mod. Is there a reason you haven't released a new version with this problem fixed?
Title: Re: Ohara YouTube Embed
Post by: Suki on February 23, 2013, 08:58:21 AM
Yes, there is, multiple reasons actually.

- There are other bugs that needs to be fixed too.
- Lack of time to properly build a regex pattern that will be able to cover most if not all of the new and valid youtube urls.
- Lack of interest on keep working on SMF mods.

The mod is open source so anyone can update the mod at will, anyone can redistribute modified version of this mod providing they comply with the license.
Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on March 05, 2013, 11:31:17 AM
i had an issue with my post.php . and since then , it stop working

even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???
Title: Re: Ohara YouTube Embed
Post by: akc42 on March 05, 2013, 12:06:58 PM
i had an issue with my post.php . and since then , it stop working

even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???

Can you be more specific.  What issue with post.php and what do you mean by stop working?

If that is the only mod installed, why not un-install it and then refresh post.php from the SMF distribution you used.

Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on March 05, 2013, 12:24:17 PM
i had an issue with my post.php . and since then , it stop working

even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???

Can you be more specific.  What issue with post.php and what do you mean by stop working?

If that is the only mod installed, why not un-install it and then refresh post.php from the SMF distribution you used.



i had issues with my post.php, so i removed it and added fresh post.php.
i have found out that some of my mod that got to do with post are no longer working. i removed and reinstall all of them including this Mod . but this seems not to respond.

i embedded a youtube video yet it's not working while the previous videos (before the issue came up) are all working but new one refuses to work!
Title: Re: Ohara YouTube Embed
Post by: akc42 on March 05, 2013, 12:47:56 PM
i had an issue with my post.php . and since then , it stop working

even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???

Can you be more specific.  What issue with post.php and what do you mean by stop working?

If that is the only mod installed, why not un-install it and then refresh post.php from the SMF distribution you used.



i had issues with my post.php, so i removed it and added fresh post.php.
i have found out that some of my mod that got to do with post are no longer working. i removed and reinstall all of them including this Mod . but this seems not to respond.

i embedded a youtube video yet it's not working while the previous videos (before the issue came up) are all working but new one refuses to work!

You keep saying things like "has issues" or "not working" without being more specific.  When you say these words add some more detail.

When you are editing a post do you see the youtube button?

When you have [youtube]some youtube url[/youtube] in your post what is the url you use (soo we can see it) and what happens. (do you see the youtube markers or do they disappear)

Did you make these changes

Quote
If there is, try to change this:

function OYTE_bbc_add_button($buttons)

with this:

function OYTE_bbc_add_button(&$buttons)

or this one

Open Sources/OharaYTEmbed.php  and find:

Code: [Select]
(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

There are 2 instances of this string, make the change to both.

and replace with this:

Code: [Select]
((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)

Back up the file first before doing the change as I haven't tested this change.

Much much more detail, else we have nothing to go on to help you.
Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on March 05, 2013, 01:23:24 PM
not working

this is what i meant.  i mistakenly remove some files inside post.php and i was unable to create New Topic or Reply

i was told to remove and replace the existing post.php with FRESH post.php

i guess that's why the youtube is not working again
Title: Re: Ohara YouTube Embed
Post by: Suki on March 05, 2013, 08:46:34 PM
You never NEVER replace a file with a new fresh copy, NEVER!

What you did not only didn't solve your first issue but it has created a lot more, whoever told you to upload a fresh file just doesn't know what are doing and I will strongly suggest not to follow their advices anymore.

Follow the mod's parser and make sure you have all the proper edits on your Post.php file: http://custom.simplemachines.org/mods/index.php?action=parse;mod=3268;attach=193586;smf_version=2.0.2
Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on March 06, 2013, 12:45:04 AM
did as the link said but didn't work

i uninstalled and installed it back and it's working now :D
Title: Re: Ohara YouTube Embed
Post by: Suki on March 06, 2013, 08:02:52 AM
It didn't work possibly because you blindly deleted other files this mod needed.
Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on March 23, 2013, 01:09:22 PM
sometimes, this mod will stop working

except you uninstall and install back?

why?
Title: Re: Ohara YouTube Embed
Post by: Suki on March 23, 2013, 03:36:16 PM
When you stop playing and modifying your files then the mod will cease "stop working". As simple as that.
Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on March 23, 2013, 06:13:12 PM
When you stop playing and modifying your files then the mod will cease "stop working" ;D. As simple as that.


i haven't touch any part of my file since 3 weeks now. so i do not know the problem
Title: Re: Ohara YouTube Embed
Post by: Suki on March 24, 2013, 09:18:01 AM
Care to explain more details then?  simply stating "doesn't work" or "stop working" is not really helpful.

Since you said the only thing that fixes it is reinstalling, I gotta say is not really a bug but its you messing around with your files, removing or changing things this mod needs, if that is the case, simply stopping doing it will solve your problem.
Title: Re: Ohara YouTube Embed
Post by: pwhodges on March 31, 2013, 09:55:04 AM
Since no working version of this that accepts http:// has been published, and lots of people have trouble with the button not showing (this happened to my forum recently), I thought I'd publish the corrections I have made for my own use.  To make the corrections you need to take the file OharaYTEmbed.php out of the zip file, edit in the changes, and then put it back in the zip file, replacing the original.

I have these changes running on my forum, and the code below is cut and pasted from my installed files; but obviously you make the changes at your own risk as I can't control your editing.

(1) To accept https URLs, and those with the "v=" parameter not the first:

Change both copies of the regex (in the routines OYTE_bbc_add_code and OYTE_Main) to:

Code: [Select]
'(https?://(?:www\.)?youtu(?:be\.com/watch\?(?:[\w\?=]*&(?:amp;)?)*v=|\.be/)(\w*)(?:&(?:amp;)?[\w\?=]*)*)'
Note that the regex to accept "https://" posted earlier by the author in this thread does not work; this is because the extra parentheses around the "http|https" options change the numbering of the strings collected by the regex, and this is not corrected for.

(2) To ensure that the YouTube BBC button is displayed in the editor:

This fault is because the mod uses a method of adding the button which is no longer supported in the final version of the 2.0 code; the change here uses the supported method instead (the button array is found from the context instead of being passed as a parameter). 

Change the routine OYTE_bbc_add_button to read as follows:

Code: [Select]
function OYTE_bbc_add_button($dummy)
{
global $txt, $modSettings, $context;

loadLanguage('OharaYTEmbed');

if (empty($modSettings['OYTE_master']))
return;

$context['bbc_tags'][count($context['bbc_tags']) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
}

I haven't tried the author's simpler suggestion of adding an & in front of the routine parameter in the original code; I had already found my correction, which works, and so have stuck with it.

I have not yet fixed the fact that smileys are not rendered following each odd-numbered video in a post, nor that quick editing of posts with no content other than the youtube tags and content fails; if I do, I will add the fixes here.

Title: Re: Ohara YouTube Embed
Post by: Suki on April 02, 2013, 10:06:42 AM
Oh, you edited your message and deleted the part where you said I won't provide more support to this.

Question is, why do I need to offer support? am I forced to do so? why do I want to keep working on a mod if I got nothing in return except complains?

People here only complains about this mod not working properly but not a single person has giving me a thank you for it, yes, this is a very small mod, however, this applies for all my modifications, people just remember you when the mod stops working or it doesn't do what you expect it to do. This whole ingratitude has pretty much driving me away.

As for your solutions.

1.- Will fail with recent and valid youtube urls.
2.- Is valid but is only valid because how SMF works by using globals vars indiscriminately. And the & thing is not solely a bug with this mod, it affects all mods that works with hooks, it has to do with passing by reference: http://www.simplemachines.org/community/index.php?topic=477624.msg3341560#msg3341560  oh and it has nothing to do with been "no longer supported on 2.0 final"  that is simple nonsense, hooks have been in SMF code as earlier as 1.1 version and the most widely used hooks are here since early RC versions of 2.0

So, yes, I no longer want to keep working on this or any other mod for that matter, it doesn't matter how much time I spent working on mods, I got nothing in return except complains.
Title: Re: Ohara YouTube Embed
Post by: pwhodges on April 03, 2013, 01:52:30 PM
I think you for providing this mod in the first place; it is entirely up to you whether you wish to support it - in your place, I would not wish to see a faulty mod going out under my name, but whatever.  I removed my earlier comment about support because, although I'd put the link to your blog, I thought it ungracious of me to point it out, and that people could find it or not as they pleased; I apologise for highlighting it for a time.

I wanted https support, and your suggestion didn't work, so I worked out why and added it my way instead, which did.  The other regex changes I made increased the number of URLs accepted, but (as I found out today) still miss some (and the original regex would have missed the same ones as well).

The missing button; yes, your solution is better - why not put it in the download so that people don't need to think you got it wrong?  My solution (and explanation) came from another thread, and fixed the problem for me - now I know it's inappropriate I will no longer do it that way.  Thanks for the correction.  (What I don't understand is why the original, without the &, ever worked at all - which it assuredly did; this is why I rather naively accepted the story about the change of supported method.)
Title: Re: Ohara YouTube Embed
Post by: Arantor on April 03, 2013, 01:58:21 PM
Quote
that is simple nonsense, hooks have been in SMF code as earlier as 1.1 version and the most widely used hooks are here since early RC versions of 2.0

Hate to contradict you but that's not entirely accurate.

The hook system in 1.1 and all the way up to 2.0 RC3 could only support one function call per hook. There are a few extra hooks in 2.0 for things like the menu, the bbc handling and so on, but these were introduced in 2.0 RC4 along with the other hook changes like multiple functions per hook.

Quote
I haven't tried the author's simpler suggestion of adding an & in front of the routine parameter in the original code; I had already found my correction, which works, and so have stuck with it

Putting the & in front of the variable inside the function declaration is the correct way to handle such things.

Quote
What I don't understand is why the original, without the &, ever worked at all

Because PHP 5.2 allowed it, PHP 5.3 deprecated it, PHP 5.4 doesn't support it at all. When this mod was originally developed, PHP 5.4 was not exactly what you would call widespread.

Quote
So, yes, I no longer want to keep working on this or any other mod for that matter, it doesn't matter how much time I spent working on mods, I got nothing in return except complains.

This is why I stopped writing mods for SMF, I fully sympathise. It seems like no good deed goes unpunished.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 03, 2013, 02:04:41 PM
Faulty? because of a missing & and youtube (a third party service) changing url schemas faster than they change their socks?

Faulty because it does not do all the things you need?

Again, please tell me why should I update the code if all I receive is complains about it?

If it is faulty then simply don't use it, build your own mod and release it here so you can get the same complains I got. Code it or STFO.

I built this because I wanted to know how the BBC hook works, this mod was built because of that, for all I know, this mod has fulfilled its purpose already since I know how the BBC hook works now.

Quote
I think you for providing this mod in the first place;

I suppose you wanted to say "thank"?  if so, where exactly did you do this?
Title: Re: Ohara YouTube Embed
Post by: Arantor on April 03, 2013, 02:10:19 PM
Quote
I built this because I wanted to know how the BBC hook works, this mod was built because of that, for all I know, this mod has fulfilled its purpose already since I know how the BBC hook works now.

Apparently it's wrong to make things just because we want to make them and were nice enough to share. Apparently we're expected to make it more than what we envisioned and wanted because we're just lowly developers who don't know any better.
Title: Re: Ohara YouTube Embed
Post by: pwhodges on April 03, 2013, 03:03:28 PM
@Suki  Yes - s/think/thank/  I'm doing it now, as you feel the need for it - and it's no less genuine for having been prompted, I assure you.

Faulty?  Yes, once the parameter no longer worked with a current version of PHP.  But, as I said, it's up to you whether or not to keep your mod up to date. 

At no point have I complained that it was faulty, or didn't do what I wanted - when I found these things I did not ask you for anything, but made the corrections myself (imperfectly, but improved for me over the original), and what's more shared what I did for any one else to try or ignore as they please.  I could have published my (now further improved) version, but I chose not to publish a mod that was simply a direct piggy-back off yours.

One difference between me and you (and other around here, it seems) is that in 44 years coding (yes, I am that old), while I like the satisfaction of doing something right, and also the satisfaction of seeing my code used, I have never looked for thanks other than from my employers.
Title: Re: Ohara YouTube Embed
Post by: Arantor on April 03, 2013, 03:14:01 PM
Quote
Faulty?  Yes, once the parameter no longer worked with a current version of PHP.  But, as I said, it's up to you whether or not to keep your mod up to date. 

It's also clear you believe that people who release things should be 'encouraged' to keep it in sync with other changes.

How often do you make something, give it away for free and then have to keep maintaining it because things outside of your control have changed? Do you enjoy this sort of thing if you do?

Quote
One difference between me and you (and other around here, it seems) is that in 44 years coding (yes, I am that old), while I like the satisfaction of doing something right, and also the satisfaction of seeing my code used, I have never looked for thanks other than from my employers.

You have a decade or so on me, then.

The thing is, it's not about 'looking for thanks'. It's simply that releasing a mod is *guaranteed* to give you a lot of people moaning. Even if you turn out a mod that doesn't require maintenance for whatever reason, and just sharing it because you thought it was nice to do (like this mod), you'll still get a wave of unappreciative people *expecting* you to provide whatever changes *they* want and will try to guilt-trip you into making it.

There are plenty of people around here who actually believe that you should be grateful that they're using your work, yes, seriously.
Title: Re: Ohara YouTube Embed
Post by: pwhodges on April 03, 2013, 04:42:12 PM
Quote
But, as I said, it's up to you whether or not to keep your mod up to date. 

It's also clear you believe that people who release things should be 'encouraged' to keep it in sync with other changes.

Clear?  As I said, and you quoted, I think it's entirely up to you (Suki in this case).  As it happens, on the evidence of this thread adding that one character to this mod would almost certainly have reduced the complaints/demands/etc relating to it.

How often do you make something, give it away for free and then have to keep maintaining it because things outside of your control have changed? Do you enjoy this sort of thing if you do?

Not often.  When I do, it's because I've made something for my own use and published it - and I maintain it as long as I myself need.  I usually ignore suggestions (without comment), unless they are good ideas I can benefit from myself.
Title: Re: Ohara YouTube Embed
Post by: Arantor on April 03, 2013, 04:46:34 PM
Yes... until the next time. And the next time. And the time after that. And the inevitable one after that. As stated, YouTube keeps changing their mind about what they'll accept. And every time they do, there will always be a request to change it in every mod that handles YouTube. So while it's only one character on this occasion, it won't be the next time.

I remember when YT first introduced youtu.be URLs and how many of the mods didn't support it. Some still don't support it properly.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 03, 2013, 09:08:00 PM
@Suki  Yes - s/think/thank/  I'm doing it now, as you feel the need for it - and it's no less genuine for having been prompted, I assure you.

Faulty?  Yes, once the parameter no longer worked with a current version of PHP.  But, as I said, it's up to you whether or not to keep your mod up to date. 

At no point have I complained that it was faulty, or didn't do what I wanted - when I found these things I did not ask you for anything, but made the corrections myself (imperfectly, but improved for me over the original), and what's more shared what I did for any one else to try or ignore as they please.  I could have published my (now further improved) version, but I chose not to publish a mod that was simply a direct piggy-back off yours.

One difference between me and you (and other around here, it seems) is that in 44 years coding (yes, I am that old), while I like the satisfaction of doing something right, and also the satisfaction of seeing my code used, I have never looked for thanks other than from my employers.

Sorry but save to yourself your forced gratitude, I find it really insulting after your very first comment here was to point out my reticent to provide support without even know the backgrounds as to why I made that decision and calling my code faulty because I refuse to add a character to a code that is open source.  I actually added that dammed "&" months ago on the github repo for this mod, but of course you didn't even think of searching for that do you? do I actually need to spoon-feed you the code? do I need to take your hand and guide you like a child?

What does surprise me is that all those years on your back and you still judge people by the first impression... 

Seriously, you don't know me, you don't know how may time I had spent here, providing mods, support, translations, code, etc and all for what? for nothing, well, not entirely nothing, I got complains and people always wanting more and more, I even got some not so nice private messages demanding me to make a completely new version of a mod for free.

I asked the community for help once, to simply test (not asked money, not asked their first born, just asked to use the mod) a free mod that would actually benefit them, guess what I receive? nothing.

I wrote/maintained 26 mods this past 3 years, guess what do I got in return? peoples complains, then I worked my ass off to solve their issues, always with a smile on my face, always willing to help and guess what I got in return? more complains, and then I provide them more support, always with a smile and always willing to help and guess what I got in return? complains. wrong if you do something, wrong if you don't, do people care about you? no they don't, all they want is use you, of course they all get angry if you aren't there for them or if you don't reply to their demands.

After some time, the smile and the willingness slowly started to disappear.

I got 11k post here, 90% of them are actually post providing support, the other 10% posts are rants just like this one ;) what do I got in return? been labeled as drama queen and not been taken seriously or simply been ignored when I have something meaningful (to me of course) to say or act.

So, I would really, really appreciate if you could try and save your judgment/comments about me not providing support for my mods anymore, it is great that you never felt the need to ask for a thank you and in all honestly I don't want you to ever get there, it feels awful. Trust me, when all you receive after 3 years of volunteer work is complains and demands for more free work, you kinda miss the feeling of receiving a simple thank you, it is a shame you cannot see that despite all those years you claim to have.

Funny you mention "employers", I also have employers and let me tell you one thing, all of them have been nothing but kind and grateful to me (I even got some awesome friendships too), even though they don't have to be nice and kind, after all, they paid me, they can yell at me if they want, they are the ones who can demand things from me and I would never ever rant about that, instead, it is the people who always want free stuff the ones who keeps complaining and demanding and acting like me, my time and my skills belongs to them and even get angry if I'm not around at their service.

Lastly, I no longer am in need for a thank you, I learned it will never come, this days I code because I want to code, if people want to use my stuff they can do so, all my code is open source and my github page is publicly available for everyone, I certainly won't spoon-feed anyone anymore, if anyone want something from me then they should work to get it.
Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on April 05, 2013, 05:26:42 AM
Care to explain more details then?  simply stating "doesn't work" or "stop working" is not really helpful.

Since you said the only thing that fixes it is reinstalling, I gotta say is not really a bug but its you messing around with your files, removing or changing things this mod needs, if that is the case, simply stopping doing it will solve your problem.
now i know the reason

if you embedded with  "https" , it will not work. except you remove the "s" .making it "http"  only
Title: Re: Ohara YouTube Embed
Post by: Oldiesmann on April 12, 2013, 02:40:17 AM
For those wanting to support both the "https" and the regular "http" URLs, I was able to get it to work by adding (?:s) after the http  in the regex, so it looks like this:

Code: [Select]
(http(?:s)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
I think there has to be a ?: in there to make the "http|https" version work as well, but the "(?:s)" is shorter and accomplishes the same thing.
Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on April 13, 2013, 02:01:51 AM
For those wanting to support both the "https" and the regular "http" URLs, I was able to get it to work by adding (?:s) after the http  in the regex, so it looks like this:

Code: [Select]
(http(?:s)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
I think there has to be a ?: in there to make the "http|https" version work as well, but the "(?:s)" is shorter and accomplishes the same thing.

where exactly id the file? i mean the place to edit it
Title: Re: Ohara YouTube Embed
Post by: Suki on April 19, 2013, 03:37:00 PM
For those wanting to support both the "https" and the regular "http" URLs, I was able to get it to work by adding (?:s) after the http  in the regex, so it looks like this:

Code: [Select]
(http(?:s)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
I think there has to be a ?: in there to make the "http|https" version work as well, but the "(?:s)" is shorter and accomplishes the same thing.

Won't work unless you also change the $1 with $2 on this part:  preg_replace($pattern, '$1', $data);

since with your change, $1 holds the "http" thing and not the ID, $2 holds the ID now.

Anyway, the mod has been updated:

1.1 - April 19, 2013,
- Fix the http/https url issue.
- Fixed the parsing smiles after a video issue.
- Fixed the pass by reference issue.
- Updated the regex to include more valid urls.

No support.
Title: Re: Ohara YouTube Embed
Post by: sangham.net on April 20, 2013, 08:16:13 AM
Thanks for your great work!

Some members of our board requested to have such possibility and I am really happy that I am able to forward them your work!

Much gratitude!

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fsangham.net%2FSmileys%2Fsadhu_sangham.gif&hash=0d556c6f3cb090a2e5fb1d5b0182cf1a)
Title: Re: Ohara YouTube Embed
Post by: pwhodges on April 21, 2013, 04:02:45 PM
Thanks for the update - the smiley correction in particular is much appreciated.

One comment: In the regex, you have added an option with ".+&" before the "v=" to allow a parameter before the video ID.  However, in my system this needs to be ".+&amp;" to work.  As I don't know if this is always true, I have used ".+&(?:amp;)?" instead which seems fine.

Oh, and clicking the Admin menu item with this version installed gives me a fatal error:
Quote
Fatal error: Call to undefined function OYTE_Who() in D:\WebPages\SMF-v2\Sources\Who.php on line 731
Uninstalling doesn't clear this, but reinstalling an older version does - I think maybe this is a left-over problem that only occurs if the older version has been previously installed; I guess the uninstall misses something.  Anyway, as a workaround, I just added back the OYTE_Who() function from the older version, and it resolved the issue for me.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 22, 2013, 10:05:42 AM
Thanks for the update - the smiley correction in particular is much appreciated.

One comment: In the regex, you have added an option with ".+&" before the "v=" to allow a parameter before the video ID.  However, in my system this needs to be ".+&amp;" to work.  As I don't know if this is always true, I have used ".+&(?:amp;)?" instead which seems fine.

Oh, and clicking the Admin menu item with this version installed gives me a fatal error:
Quote
Fatal error: Call to undefined function OYTE_Who() in D:\WebPages\SMF-v2\Sources\Who.php on line 731
Uninstalling doesn't clear this, but installing an older version does - I think maybe this is a left-over problem that only occurs if the older version has been previously installed.  Anyway, as a workaround, I just added back the OYTE_Who() function from the older version, and it resolved the issue.

Sorry, but from now on I will refrain from having any kind of conversation with you, go ahead and post this on your forum so your members can talk trash about me again :)

Oh, the OYTE_Who() is because you need to uninstall any old version first. Adding that function back does not solve the issue, the only thing it does is repeating my copyright in the credits page.
Title: Re: Ohara YouTube Embed
Post by: rw012 on April 23, 2013, 01:41:31 PM
I have a question.   When I click the youtube icon after installing the latest version on 2.04 , I get these tags:

Code: [Select]
[/youtube][youtube]   rather than 
Code: [Select]
[youtube][/youtube]
Can you give me some suggestions on how to fix that?

Thanks.
Title: Re: Ohara YouTube Embed
Post by: johnpaul2k2 on April 25, 2013, 04:48:44 PM
For those wanting to support both the "https" and the regular "http" URLs, I was able to get it to work by adding (?:s) after the http  in the regex, so it looks like this:

Code: [Select]
(http(?:s)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
I think there has to be a ?: in there to make the "http|https" version work as well, but the "(?:s)" is shorter and accomplishes the same thing.

Won't work unless you also change the $1 with $2 on this part:  preg_replace($pattern, '$1', $data);

since with your change, $1 holds the "http" thing and not the ID, $2 holds the ID now.

Anyway, the mod has been updated:

1.1 - April 19, 2013,
- Fix the http/https url issue.
- Fixed the parsing smiles after a video issue.
- Fixed the pass by reference issue.
- Updated the regex to include more valid urls.

No support.


working perfectly ok :D
Title: Re: Ohara YouTube Embed
Post by: I Use Dial on May 04, 2013, 02:02:05 PM
Can someone tell me an easy way to me to inform users of this feature? Like putting
Code: [Select]
[youtube]<YouTube share link>[/youtube] text in the WYSIWYG or bellow the comments box?
Title: Re: Ohara YouTube Embed
Post by: sangham.net on May 05, 2013, 12:27:52 PM
You could send an News-PM to every member including a funny video and make a topic, I Use Dial.
Title: Re: Ohara YouTube Embed
Post by: I Use Dial on May 05, 2013, 06:10:06 PM
Also, you could leave here and never return.
Title: Re: Ohara YouTube Embed
Post by: Arantor on May 05, 2013, 06:12:53 PM
Also, you could be a little more respectful of someone offering a suggestion, just because the suggestion doesn't work for you. On some forums it would be quite acceptable to do so.
Title: Re: Ohara YouTube Embed
Post by: I Use Dial on May 05, 2013, 06:16:53 PM
It was obviously a smart-ass response, not a real suggestion.
Title: Re: Ohara YouTube Embed
Post by: Arantor on May 05, 2013, 06:24:58 PM
No, it wasn't a smart-ass response and didn't warrant a smart-ass reply.
Title: Re: Ohara YouTube Embed
Post by: I Use Dial on May 05, 2013, 06:38:16 PM
Really? You think that making a video named after my handle name (on this forum) is an effective way to inform board users of a post entry feature? Seriously? Also, the suggestion is NOTHING like my request, which specifically asks for a way to add text somewhere around the comments box.

Sorry to waste so much of this support forum's time in asking questions. I swear, this is what I get with the vast majority of open source project 'communities' now, and the forum mods tend to be perfectly happy to send off people looking for solutions so they can support and retain the people who drive them away.
Title: Re: Ohara YouTube Embed
Post by: Arantor on May 05, 2013, 06:44:35 PM
He didn't say you had to make a video named after your handle. He was making the suggestion and just addressing it to you.

You know, like me saying:
"You don't have to be so rude to someone just trying to offer a suggestion, I Use Dial." Because that's all he did, he made a comment and wanted to indicate to whom it was intended.

For some forums, yes, it would actually be appropriate. Small forums, close-knit, with not-entirely-technical members, they'd appreciate such a video, actually.

Quote
Also, the suggestion is NOTHING like my request, which specifically asks for a way to add text somewhere around the comments box.

That's one of the things that you don't necessarily realise. What you want is a way to inform members. There are *other* ways of doing it than what you've thought of.

In fact there are other ways of doing embedding entirely, like not requiring bbcode and just posting the link and have the forum do all the work. But no, you're convinced that your way is the One True Way and won't hear anything against it.

Quote
I swear, this is what I get with the vast majority of open source project 'communities' now

If you act this much like a smart-ass everywhere else, I really wouldn't be surprised.

Quote
and the forum mods tend to be perfectly happy to send off people looking for solutions

Running a forum is not an easy ride. It takes work and dedication. One would assume that if you're already dedicated enough, you'd spend a little time trying to find the answer yourself before posting (this is not directed at you specifically, but as a general observation) - trouble is most of the people who come here asking haven't bothered to search or spend any effort themselves in trying to find an answer.

Remember: those of us who offer help, in whatever form, do so in our spare time and we had to learn it all somewhere first. We didn't magically have it dumped into our brains, we had to work to figure it all out - and we're sharing. Is it so wrong to expect people to spend a little effort first before getting help? Or are you of the belief that you are entitled to something just because you ask for it?
Title: Re: Ohara YouTube Embed
Post by: Suki on March 05, 2014, 12:49:07 PM
New version 1.2.

Changelog:

- Adds support for vimeo urls via the vimeo oembed API, currently their API only support this formats:
vimeo.com/[ID]
vimeo.com/channels/[channel name]/[ID]
vimeo.com/groups/[Group name]/videos/[ID]

- Adds auto-embed function for both youtube and vimeo, now you don't have to use their respective tags, just past a valid url. The tags are still supported and you can still use them, Your old tags will still work too. You can mis pure urls with bbc tags.
- Add support for the old [yt] for those who still have those tags.

- This new version requires PHP 5.3 or greater, old version 1.1 can be found at github: https://github.com/MissAllSunday/OharaYouTubeEmbed/releases  the green button is a ready-to-install package.

To upgrade from previous versions, uninstall the old mod and install the new version. You won't lose any tag or setting.
Title: Re: Ohara YouTube Embed
Post by: Shazar on March 14, 2014, 05:35:39 PM
Just installed this on my new forum and it works nicely - thanks!   :D
Title: Re: Ohara YouTube Embed
Post by: ktysinger1 on March 15, 2014, 10:29:37 PM
Is there an easy way to make it have the option to play fullscreen?

Nevermind. I found the solution. Just add allowfullscreen to the two youtube iframes. It appears to work fine.

<iframe width="'. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'" height="'. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'" src="http://www.youtube.com/embed/$1" allowfullscreen frameborder="0"></iframe>
Title: Re: Ohara YouTube Embed
Post by: kamili34 on March 16, 2014, 10:29:11 AM
How not to center the window of the movie.  I would like on the left side of the post not in center.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 16, 2014, 10:40:22 AM
In Sources/OharaYTEmbed.php find:

<div style="text-align:center;margin:auto;padding:5px;" class="youtube $1">

and replace with:

<div style="text-align:left;margin:auto;padding:5px;" class="youtube $1">
Title: Re: Ohara YouTube Embed
Post by: kamili34 on March 16, 2014, 05:34:52 PM
thanks :)
Title: Re: Ohara YouTube Embed
Post by: The QE2 Story Forum on March 23, 2014, 12:40:14 PM
Works great on my SMF Forum (2.0.7.) - clean install, first time.
Title: Re: Ohara YouTube Embed
Post by: STRRAYNGE on March 24, 2014, 11:47:20 AM
Ive installed this mod, and it works great, other than I cannot get it to auto-embed? I can click the youtube button in the post section and it will insert youtube tags around the URL and it works that way, but for some reason this mod, or any other I have tried just will not auto-embed. This function previously worked with a different mod I was using, but nothing works now? Any suggestions? My PHP version is 5.3
Title: Re: Ohara YouTube Embed
Post by: Suki on March 24, 2014, 12:09:20 PM
Did you get any errors during install?  is there any error on your error log?  whats the url you're trying to embed or the urls. do they get converted to regular links?
Title: Re: Ohara YouTube Embed
Post by: STRRAYNGE on March 24, 2014, 12:25:18 PM
no errors whatsoever during install or in error log? Here is one video im trying to post, just to test, and all that shows up is the URL after I submit post.  https://www.youtube.com/watch?v=PTPn8oLKvho
Title: Re: Ohara YouTube Embed
Post by: Suki on March 24, 2014, 01:28:26 PM
mmm, I cannot reproduce the error on my server.  Are you sure you have the latest version installed? only version 1.2 has the autoembed feature.

Can you attach your Sources/Subs.php file here.
Title: Re: Ohara YouTube Embed
Post by: STRRAYNGE on March 24, 2014, 01:53:50 PM
I do have the latest version installed. I also checked the code and it has the correct edits in the subs.php. Could aeva media be causing any issues? I looked at the edits for the post.php, and im not finding a single <img> line. There are only 2 lines with an img code in them? One contains this <img><iframe><object><embed><iframe> and the other is under Aeva media changes which contains this <img><object><embed><iframe>? I will try to attach my subs.php on my lunch break.
Title: Re: Ohara YouTube Embed
Post by: STRRAYNGE on March 24, 2014, 02:06:38 PM
Im doing some quick checks. Ill report back shortly if I get this figured out or not. Thank you for responding so quickly!!
Title: Re: Ohara YouTube Embed
Post by: FemR on April 17, 2014, 07:52:19 AM
Hi suki,

Thanks for such a great mod, been using it for several years  :D

I installed the latest 1.2, updated PHP to 5.3, works good except no auto-embed as mentioned above. What happens is on post preview it will autoembed fine, but once I hit Post it just gets wrapped in URL tag and shows it like a regular link.

I too have Aeva installed as mentioned above, however have its auto-embedding turned off.

Not a huge deal if autoembed doesn't work, wrapping it the old-fashioned way in youtube tag still works fine. I'm on 2.0.2, attaching my subs.php
Title: Re: Ohara YouTube Embed
Post by: Suki on April 17, 2014, 12:13:03 PM
It seems the AEVA code interferes and somehow modifies the $message var so when that var gets passed to OYTE_Preparse() the tags has been already changed and so the checks this mod performs fails, easiest and dirtiest thing to do is just move this mod's code above the AEVA code:

On Sources/Subs.php find:

Code: [Select]
// Aeva Media changes
if (empty($parse_tags) && empty($context['uninstalling']))
{
global $sourcedir;

if (stripos($message, '[smg') !== false)
{
if (!function_exists('aeva_protect_bbc'))
require_once($sourcedir . '/Aeva-Subs.php');
aeva_protect_bbc($message);
}

// Protect noembed & autolink items from embedding *before* BBC parsing - wrap quotes, but don't protect
if (!empty($modSettings['aeva_enable']) && strlen($message) > 15)
{
if (!function_exists('aeva_preprotect'))
require_once($sourcedir . '/Aeva-Embed.php');
aeva_preprotect($message, $cache_id);
}
}
// End Aeva Media changes

// Ohara youtube embed
$message = OYTE_Preparse($message);

and replace with:


Code: [Select]
// Ohara youtube embed
$message = OYTE_Preparse($message);

// Aeva Media changes
if (empty($parse_tags) && empty($context['uninstalling']))
{
global $sourcedir;

if (stripos($message, '[smg') !== false)
{
if (!function_exists('aeva_protect_bbc'))
require_once($sourcedir . '/Aeva-Subs.php');
aeva_protect_bbc($message);
}

// Protect noembed & autolink items from embedding *before* BBC parsing - wrap quotes, but don't protect
if (!empty($modSettings['aeva_enable']) && strlen($message) > 15)
{
if (!function_exists('aeva_preprotect'))
require_once($sourcedir . '/Aeva-Embed.php');
aeva_preprotect($message, $cache_id);
}
}
// End Aeva Media changes


And I still don't think thats gonna solve the issue, I haven't installed AEVA in years so I don't know how exactly that mod works, just looking at the code, the call to aeva_preprotect($message, $cache_id); is the responsible for changing the message, appliying this code's changes before calling that function may r may not work, it all depends on what exactly aeva_preprotect($message, $cache_id);  does.
Title: Re: Ohara YouTube Embed
Post by: synewave on April 18, 2014, 03:12:42 AM
Hi,

I've installed and used this mod successfully on an SMF board I use for testing on a standard hosting account.

The forum I want to use it on is hosted by my friend's company and I am having issues. I don't have the standard cPanel. I have previously had issues with Wordpress re: not being able to update automatically or install plugins.

-------------------------------------------------------------------

I'M NOT SURE THIS IS THE ROOT ISSUE

Initially I installed the mod but didn't read the instructions properly and didn't check "Install in Other Themes".

(First time, the installation failed. I created a ./Packages/temp directory and chmod to 777, then it seemed to install okay. However I did not have the - Admin->Configuration->Modifications options nor the Youtube button in posts.)

So I have been trying to uninstall the mod so I can try to re-install it correctly (although I am not convinced this will solve my issue)...but I am getting this error:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.fruitisthetruth.com%2Fupload_images%2Funinstall-errors.png&hash=f675adaa1c9b4eb815fecdf5a1db1ba1)

I tried chmod to 777 on the files ./Sources/Post.php and ./Sources/Subs.php but I still get the same error.

-------------------------------------------------------------------

Any tips?

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.fruitisthetruth.com%2Fupload_images%2Fpermissions.png&hash=3aa9b507e3fb83bfc92275dc267442f6)

SMF Package   SMF 2.0.7   SMF 2.0.7
Sources   2.0.7   2.0.7
Default Templates   2.0.7   2.0.7
Language Files   2.0.7   2.0.4
Title: Re: Ohara YouTube Embed
Post by: FemR on April 18, 2014, 03:49:00 AM
It seems the AEVA code interferes and somehow modifies the $message var so when that var gets passed to OYTE_Preparse() the tags has been already changed and so the checks this mod performs fails, easiest and dirtiest thing to do is just move this mod's code above the AEVA code:

On Sources/Subs.php find:

Code: [Select]
...
and replace with:

Code: [Select]
...

And I still don't think thats gonna solve the issue, I haven't installed AEVA in years so I don't know how exactly that mod works, just looking at the code, the call to aeva_preprotect($message, $cache_id); is the responsible for changing the message, appliying this code's changes before calling that function may r may not work, it all depends on what exactly aeva_preprotect($message, $cache_id);  does.


Thanks for the suggestion, Suki; as you suspected, it didn't solve it.
At least using YT tag works fine, so not getting autoembed is not crucial to the mod enjoyment  ;)

BTW notice how differently it tries to handle the 2 YT link formats:

Trying to post these like so:
Code: [Select]
http://youtu.be/bzw9hjmMbdA
http://www.youtube.com/watch?v=bzw9hjmMbdA

Results in these 2 forms of autoembedding once posted:

Code: [Select]
[url=http://youtu.be/bzw9hjmMbdA]http://youtu.be/bzw9hjmMbdA[/url]
[url=http://www.youtube.com/watch?v=bzw9hjmMbdA#ws]Ronda Rousey vs. Floyd Mayweather; Who Ya Got?[/url]

I'm not a PHP coder but something works partially, I mean how does it at least get the anchor text from the youtubes?
Title: Re: Ohara YouTube Embed
Post by: Suki on April 18, 2014, 09:23:07 AM
@synewave  if you already installed it and want to install it again, then you will face several issues since you are trying to apply code that is either already there or misplaced.

You will have to follow the mod's parser: http://custom.simplemachines.org/mods/index.php?action=parse;mod=3268;attach=229618;smf_version=2.0.7

and check all the file edits this mod does, be sure the code changes are there, if everything is in place then you can proceed with the installation since you also need to apply the hook calls, ONLY if everything is already there.


You can also manually install the mod, do the file changes manually, upload hooks.php  to your forum root and call it via browser: mysite.com/forum/hooks.php   and copy the mod's Themes and Sources directories to your forum's root, overwriting your own Themes and Sources directories.

@FemR  It doesn't, this mod doesn't do that, thats the AEVA mod, having AEVA and this mod at the same time is not a good idea, too many things will clash and unless theres a way to absolutely disable the auto embedding part in AEVA, you will continue to have issues.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on May 09, 2014, 03:55:24 AM
Just a quick thank you for the mod and i am very sorry for the way some people treated you here, hope you will keep it up for people like me not knowing how to code these things but appreciating and being grateful towards who is actually capable of doing it. Thanks again, cheers.

@arantor you are just a legend here, if anyone denies it well it's just because he is retarded 100%. Don't bother them, there are people like me but i'm pretty sure like many others that really appreciate what you did. You may say not too many and you would be right but people are stupid mostly, you certainly know that. The big difference is that stupid people will be stupid also in organizing their forums while smart people will be smart in that field as well. Thanks again to you as well, cheers man, smf (maybe some idiots don't but nvm) misses you.
Title: Re: Ohara YouTube Embed
Post by: mantu2 on May 15, 2014, 03:36:32 PM
Hi and thanks for the great mod.

I installed mod today and found out one slight problem. The mod changed every youtube link to a video screen in the forum. There is some topics were people wants to use just links. Now it just doesn't matter do you use tags or not - the video is in the post. What to do? I'm using latest version of SMF
Title: Re: Ohara YouTube Embed
Post by: Suki on May 23, 2014, 11:23:57 AM
Yeah, thats the intended default behavior.

You can use the old version which doesn't have auto embed urls https://github.com/MissAllSunday/OharaYouTubeEmbed/releases/tag/v1.1  the green button is a ready to install zip.

In the old verison you need to use the youtube tags for the video to embed.
Title: Re: Ohara YouTube Embed
Post by: mantu2 on May 29, 2014, 08:49:15 AM
Thanks! It works. However, there is no Vimeo link possibility. That is not making great harm because most of links are Youtube videos anyway. Is it possible to get Vimeo links to work with link option I need?
Title: Re: Ohara YouTube Embed
Post by: Suki on May 30, 2014, 12:59:11 PM
Oh yeah, I forgot the old version didn't have vimeo support.  Easiest way to solve that is by using the current version OharaYTEmbed.php file, the old and new versions are compatible so just grab that file from the current release and upload it to your Sources/  folder re-writting your old file.
Title: Re: Ohara YouTube Embed
Post by: mantu2 on June 01, 2014, 08:58:46 AM
Nearly perfect. Just didn't give the vimeo-tab to writing view. How to fix that?
Title: Re: Ohara YouTube Embed
Post by: Suki on June 05, 2014, 11:36:27 AM
I'm sorry, I didn't understand your question.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on June 05, 2014, 02:43:57 PM
I'm sorry, I didn't understand your question.
You are not the only one.
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on June 14, 2014, 12:00:18 PM
Hi there, did not see where it says install on other themes at install ?

My Bad I thought it was a check on the program not the theme part ooops.
But installed other theme and still no shows.
Title: Re: Ohara YouTube Embed
Post by: Suki on June 14, 2014, 12:49:31 PM
There should be a check on install:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FKMGBjs5.jpg&hash=55c1fd899fe003cbfdca8173c3446890)

what do you mean by "no shows"  what exactly do you mean by that.
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on June 14, 2014, 03:17:53 PM
Sorry the button in the postings  is not visible.
When you make a post no button to use for yourtube.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on June 14, 2014, 03:55:02 PM
Title: Re: Ohara YouTube Embed
Post by: klra on June 14, 2014, 07:13:55 PM
I'm having trouble installing this in 1 of my 3 forums. PHP ver 5.4 installed, SMF ver 2.0.7

All three forums are using the same themes and the mod works great in 2 of them.

But after I upload the file in the Pacakage Mgr in the 3rd forum, it wants FTP info in order to change file permissions while installing the mod.

This was not the case for the 1st 2 installs.

When I gave it the ftp info it changed my main folder permissions, crashed the forums (500 error) and my host helped me get it changed back. Installation failed.

So here's my question-

What files or folders need to have their permissions changed before installing the mod?

I can't seem to find anything different in the 3 forum folders.

Thanks
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on June 14, 2014, 08:01:18 PM
  • If you have a custom theme you should follow Suki's screenshot
  • You should check that the BBC is enabled in Administration » Posts and Topics » Bulletin Board Code
  • Was the installation successfull in all steps or did it fail anything?
  • Did you make any custom edits
  • Mods installed?
  • Error log clear or showing some errors related to this mod?


Sorry for the delay, no issues and everything is checked, no errors no real mods .
I will try a reinstall again, but for some reason its not showing up.
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on June 14, 2014, 08:05:40 PM
Maybe it was a bad download, removed and dl'd it . Reinstalled and it showed the tools to check the mod active and then was in the posting areas. So all is working thank you for the help.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on June 14, 2014, 08:39:07 PM
Maybe it was a bad download, removed and dl'd it . Reinstalled and it showed the tools to check the mod active and then was in the posting areas. So all is working thank you for the help.
If you searched directly from your forum via package manager you should be reading this --> http://www.simplemachines.org/community/index.php?topic=521782.msg3691381#msg3691381

@klra I saw your post but as I am not totally sure about the answer I'll wait for Suki on that one.
Title: Re: Ohara YouTube Embed
Post by: klra on June 15, 2014, 09:11:22 AM
I'm having trouble installing this in 1 of my 3 forums. PHP ver 5.4 installed, SMF ver 2.0.7

All three forums are using the same themes and the mod works great in 2 of them.

But after I upload the file in the Pacakage Mgr in the 3rd forum, it wants FTP info in order to change file permissions while installing the mod.

This was not the case for the 1st 2 installs.

When I gave it the ftp info it changed my main folder permissions, crashed the forums (500 error) and my host helped me get it changed back. Installation failed.

So here's my question-

What files or folders need to have their permissions changed before installing the mod?

I can't seem to find anything different in the 3 forum folders.

Thanks

Anyone?
Title: Re: Ohara YouTube Embed
Post by: Suki on June 15, 2014, 09:16:09 AM
Bumping your posts after 14 hours isn't gonna make me want to help you, really.

The issue is not within this mod anyway, you have some file permissions issues and installing any mod will give you the same results as this.

Make sure you have all the permissions required: http://wiki.simplemachines.org/smf/Installing#Set_File_and_Folder_Permissions
Title: Re: Ohara YouTube Embed
Post by: klra on June 15, 2014, 10:40:35 AM

The issue is not within this mod anyway, you have some file permissions issues and installing any mod will give you the same results as this.

Make sure you have all the permissions required: http://wiki.simplemachines.org/smf/Installing#Set_File_and_Folder_Permissions

Interesting that the other installed mods did not need FTP access to change permissions when they were installed.

What files need to have their permissions changed or checked?

I can compare between forum installations to find the incorrect permission.
Title: Re: Ohara YouTube Embed
Post by: Suki on June 15, 2014, 11:38:54 AM
Probably because the other installed mods didn't require the same files/folders to be writable or the files they needed were already writable.

The folders this mod modify are the ones needed to be writable, most likely the Themes/default/images/bbc/ one.
Title: Re: Ohara YouTube Embed
Post by: klra on June 16, 2014, 02:38:45 PM
Ok, I solved the problem-  :D

I looked compared the permissions from all 3 forums and could not find any differences.

When I looked in the forum that was having issues with the install, I saw that the forum software had left behind the fils & folders of themes that had been tested then "removed" withing the SMF Admin Theme area.

So I manually deleted the extra theme's folders/files on the server and the mod installed perfectly.

My gues is when the checkbox to install the mod into other themes was selected, it tried to go to the folders that it saw, even though the forums software didn't see them.

Title: Re: Ohara YouTube Embed
Post by: Steelio on July 23, 2014, 07:03:57 AM
hi Suki,

i was wondering if there is a way/ instructions to install this mod manually? i'm having problems installing mods via SMF's package manager so im considering using an FTP client (like Filezilla or is there something else better?).
Title: Re: Ohara YouTube Embed
Post by: margarett on July 23, 2014, 08:33:56 AM
Yup, of course ;) For every mod there is:
Manual Installation of Mods (http://wiki.simplemachines.org/smf/Manual_installation_of_mods)
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on July 23, 2014, 09:36:03 AM
Also, about how to install this specific mod http://custom.simplemachines.org/mods/index.php?action=parse but click on your version first, unluckily the MOD site doesn't support links to specific version parsed instructions =_=
Title: Re: Ohara YouTube Embed
Post by: Suki on July 23, 2014, 09:40:33 AM
Also, about how to install this specific mod http://custom.simplemachines.org/mods/index.php?action=parse but click on your version first, unluckily the MOD site doesn't support links to specific version parsed instructions =_=

Thats not a valid link

This is the instructions to perform a manual install:

http://custom.simplemachines.org/mods/index.php?action=parse;mod=3268;attach=229618;smf_version=2.0.8

The most important thing is getting the hooks installed by uploading and running the "addHooks.php" file.  Upload it to your forum root directory (where SSI.php resides)  and call it with your browser:  myforum.com/addHooks.php
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on July 23, 2014, 09:47:47 AM
Sure YOU can upload that link while I can't :) because if I click on parse it will pop out only the link I provided. Thanks for your link anyway :D
Title: Re: Ohara YouTube Embed
Post by: Suki on July 23, 2014, 09:52:24 AM
Everyone can use that link....   I discovered it ages ago even before I started to post here...

On top of the navigation bar theres a bar with the name of the mod and a legend: "Installation Instructions for x.x.x"  you just need to copy that link.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on July 23, 2014, 09:57:34 AM
Wtf =_= thanks for that, even though I am *very* unhappy with that. Defining it "not friendly" would be pure sarcasm. Who could ever think about clicking on the navigation bar of a research already? I really don't like it but thanks a lot, it will be very useful when I will be linking instructions :D
Title: Re: Ohara YouTube Embed
Post by: Suki on July 23, 2014, 10:00:06 AM
Please use this topic to discuss my modification, if you want to discuss somthing else, please do so elsewhere.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on July 23, 2014, 10:05:25 AM
It WAS about your modification indeed! In fact the link you have provided is related to it, itself. While thanking you and asking where you could get that from I commented it without posting anymore? Can't I even comment now? Sorry but if you say that I can't even say thanks to YOU for providing something useful you are being rude.
And no one ever wanted to discuss about that link story, but comment on it yes since it was you posting it in your own topic.
Handshake and friends now? :)
Title: Re: Ohara YouTube Embed
Post by: Suki on July 23, 2014, 10:13:01 AM
You started to rant about how unfriendly that link page is.... It has nothing to do with my mod as it affects every single mod listed overthere. Thus, you should really discuss it someplace else.

So, again, if you want to discuss how awful that page is, please do so elsewhere, this is not the correct place for it.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on July 23, 2014, 10:15:35 AM
thanks for that
thanks a lot, it will be very useful when I will be linking instructions :D
It was not just rants. Can't you see it? Now I hope you did. No more questions regarding your mod so bye and thanks again :)
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on August 09, 2014, 07:09:59 PM
Hi there, installed no errors however the tag only inputs   [youtube] .
Any ideas ?
Title: Re: Ohara YouTube Embed
Post by: Suki on August 10, 2014, 11:12:49 AM
Gotta give more info.

Do you mean when pressing the youtube button or when you're inserting a video?
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on August 10, 2014, 01:18:18 PM
I thought I did lol, when you push the Youtube button it gives only the [youtube] ?
Should it not give dual brackets on both sides ?

Thanks
Title: Re: Ohara YouTube Embed
Post by: Suki on August 10, 2014, 01:35:14 PM
Yes it should be and its what it does unless something else mess things up.

Do you have any other mod that modifies BBC? had you made any change to Sources/OharaYTEmbed.php ?

Don't really understand whay you mean by "dual brackets", anyway, the code for that part is pretty straight forward:

Code: [Select]
$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);

Make sure you have exactly that on your Sources/OharaYTEmbed.php file.

Also, this mod will not work with the WYSIWYG mode.
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on August 10, 2014, 01:58:37 PM
 Hi there,

I am running WYSIWYG, but it works if I add a video after the [yourtube] Videolink here.

Just the other side of the bracket normally seen [youtube\] does not show up or work if inserted.

Is there a way I can add to fix that ??
Title: Re: Ohara YouTube Embed
Post by: Suki on August 10, 2014, 02:09:35 PM
You can begin with what I already said:


Code: [Select]
$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);

Make sure you have exactly that on your Sources/OharaYTEmbed.php file.


And also answering my questions:

Quote
Do you have any other mod that modifies BBC? had you made any change to Sources/OharaYTEmbed.php ?


If you're using the WYSIWYG mode chances are thats the issue, it has all sorts of problems with it, sometimes the tag doens't show, sometimes it show backwards: [youtube][/youtube]  etc. Unfortunately, I won't be fixing those issue as its just a big waste of time.
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on August 10, 2014, 03:18:21 PM
You can begin with what I already said:


Code: [Select]
$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);

Make sure you have exactly that on your Sources/OharaYTEmbed.php file.


And also answering my questions:

Quote
Do you have any other mod that modifies BBC? had you made any change to Sources/OharaYTEmbed.php ?
 


If you're using the WYSIWYG mode chances are thats the issue, it has all sorts of problems with it, sometimes the tag doens't show, sometimes it show backwards: [youtube][/youtube]  etc. Unfortunately, I won't be fixing those issue as its just a big waste of time.


No no changes in the Sources/OharaYTEmbed.php ?

******************

Was unsure about the code changes applied since since was unsure the issues I was asking was the one you were answering.  Its ok, no biggy its consistent with [Youtube] I will just instruct my members to use it accordingly.
As I can not disable WYSIWYG as it require for many of our users.

I can also understand you not wanting to make it work with WYSIWYG, Its your mod and you can create it to work or not work with what ever you choose. However at http://custom.simplemachines.org/mods/index.php?mod=3268
There is no mention ( I saw) that this mod is is not WYSIWYG compatible. And being WYSIWYG is part of the posting system you might avoid people asking the same question I did by saying on the mod area not compatible with WYSIWYG.
It would not be by reasonable for users to assume they should not use particular parts of SMF on a mod, so noting that would be helpful I am sure.

Thanks for the help and code I will check it out.










Title: Re: Ohara YouTube Embed
Post by: Suki on August 10, 2014, 03:34:23 PM
Its not about me not wanting to fix those issues, it really comes down to the WYSIWYG mode been so buggy, no matter what I would do to fix an issue, more will arise and so on and on and on, hence the "big waste of time" phrase.

The mod as it stands doesn't work as people expect it to work on WYSIWYG mode, thing is, even disabling this particular BBC when using that mode is quite a hassle itself. So a hassle for avoiding another hassle makes no sense to implement.
Title: Re: Ohara YouTube Embed
Post by: Arantor on August 10, 2014, 03:39:14 PM
Actually, the WYSIWYG editor was specifically designed not to handle complex tags. It won't even touch quotes - and that's not a bug, that's literally by design.
Title: Re: Ohara YouTube Embed
Post by: br360 on August 19, 2014, 12:24:40 AM
I'm seeing a few of these undefined errors a day.
Code: [Select]
8: Undefined index: OYTE_unvalid_linkApply
/var/www/vhosts/mysite.com/Sources/OharaYTEmbed.php(60) : runtime-created function
Line: 5

There doesn't seem to be a rhyme or a reason to the error, as it happens when people are doing things like checking the member list, doing a search of the forum, registering for an account, checking their pm's, etc. (and not when trying to post a youtube video)

When I go to press on the link in the error logs, I get this message that now becomes a new general error- "An Error Has Occurred! Sorry but the file specified could not be opened:"

Line 5 in that file is
Code: [Select]
* @version 1.1
I checked my package manager, and I am definitely using version 1.1. I have also checked and unchecked "Disable evaluation of templates", and the error looks exactly the same either way.

I am currently using 2.0.7, but the issue was happening before I patched.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 19, 2014, 09:11:59 AM
The error isn't actually on line 5 but on line 60, the five indicates the inner line inside the create_function()

A person doesn't have to be postign a video, this code wil be executed everytime someone calls parse_bbc() which is a function that is called on a lot of places, hence why the error appears on pages that doens't have anything to do with posting.


As for the error, you need to make sure your language files are uploaded correctly on the proper folder /themes/default/languages/

Theres also a new version, version 1.2: https://github.com/MissAllSunday/OharaYouTubeEmbed/releases  which is the current stable one.
Title: Re: Ohara YouTube Embed
Post by: br360 on August 19, 2014, 12:33:56 PM
Thanks Suki, good information to know.

The OharaYTEmbed.english.php looks fine to me, and everything does seem to be uploaded. Anything in particular I should be looking for?

I glanced over 1.2 briefly. Does it auto-embed videos, or can I disable that so people would still have to use the youtube tags in order for a video to show?
Title: Re: Ohara YouTube Embed
Post by: Suki on August 19, 2014, 02:53:52 PM
It could be related to the actual text string which expects to be used along with sprintf(),  probably should be using something like this:

sprintf(txt['OYTE_unvalid_link'], 'youtube');

you could try and change the code in line 55:

$data = $txt[\'OYTE_unvalid_link\'];

with this:

$data = sprintf($txt[\'OYTE_unvalid_link\'], 'youtube');



Title: Re: Ohara YouTube Embed
Post by: Aaron10 on August 20, 2014, 11:38:41 AM
Hi, I'm using this mod as you recommended yesterday and it works great, but the perimeters don't seem to work, for example a playlist shows like this:
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,92.html

[the current video I linked from]
?list=PL345B49A52C73B94E

And also if you use the share code with a time perimeter:
http://youtu.be/Fj4alwt0FgA?t=42s

It'll remove the t= when switch it to a regular youtube URL.

Also how do I edit these in vimeo embed:

webkitallowfullscreen mozallowfullscreen

and change:

frameborder="0" to style="border: none;" (this I already did on the youtube ones).

These are minor issues though and I'm happy to use the mod, many thanks.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 20, 2014, 01:13:56 PM
Can you post an url that includes a ?list param. a list of urls that causes the same issue would be handy too.

I'm afraid getting the start time will be tricky, it is already pretty difficult to get the video ID from all the different kinds of valid urls, I'm currently using 2 regex and PHPs native parse_url() to get the videos IDs and even with those 3 layers for catching the ID, there are still valid urls that will not be catched, adding one more param to get the ?t= value will make things even more difficult to handle :(

About vimeo, I'm currently using their oEmbed api which doesn't have a param to disallow or allow "webkitallowfullscreen" or " mozallowfullscreen"  it also doesn't allow you to modify the frameborder="0" param.


If you really want to change those values, the code will have to be re-written to use vimeo's Universal Player which is a much more customizable option.
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on August 20, 2014, 01:44:03 PM
It's actually doing it for both & and ? params. The ? only comes from the youtu.be share link

http://youtu.be/Fj4alwt0FgA?list=PL345B49A52C73B94E

Full link uses &
https://www.youtube.com/watch?v=Fj4alwt0FgA&list=PL345B49A52C73B94E

But also displays like the other:
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,92.html
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,94.html

Another with the playlist param:
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,95.html

Same thing for both, list=PL345B49A52C73B94E appears as text underneath the videos.

So for vimeo, where would I put this example URL in oharaYTEmbed.php:

<iframe src="//player.vimeo.com/video/71646438" width="500" height="281" style="border: none;"></iframe>
Title: Re: Ohara YouTube Embed
Post by: Bluedreams on August 21, 2014, 09:43:04 AM
Thank you for being one of the few working embed mods left!
Title: Re: Ohara YouTube Embed
Post by: Suki on August 21, 2014, 10:41:56 AM
It's actually doing it for both & and ? params. The ? only comes from the youtu.be share link

http://youtu.be/Fj4alwt0FgA?list=PL345B49A52C73B94E

Full link uses &
https://www.youtube.com/watch?v=Fj4alwt0FgA&list=PL345B49A52C73B94E

But also displays like the other:
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,92.html
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,94.html

Another with the playlist param:
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,95.html

Same thing for both, list=PL345B49A52C73B94E appears as text underneath the videos.

So for vimeo, where would I put this example URL in oharaYTEmbed.php:

<iframe src="//player.vimeo.com/video/71646438" width="500" height="281" style="border: none;"></iframe>

OK, thanks for the urls, I'm going to release a new version with  a fix for them.  I'll include a setting to disable/enable the auto embed too and will change the vimeo oembed api for the universal embed so it will be easier for people to customize the iframe.

Thank you for being one of the few working embed mods left!

Thanks!
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on August 21, 2014, 11:03:46 AM
Ok I look forward to it and thanks for your hard work. Also forgot to ask, is it possible to allow the embeds to also work within quote tags?
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,99.html
Title: Re: Ohara YouTube Embed
Post by: Suki on August 21, 2014, 11:12:03 AM
It should work just fine if you quote a message that contains an embedded video.  How exactly are you posting it?  If you're quoting a message that already converted an url to a link then nop, the embed code will not work since that url is already a link.
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on August 21, 2014, 11:22:26 AM
Posted via plain link which was auto embedded then quoted.
Title: Re: Ohara YouTube Embed
Post by: mercelo on August 21, 2014, 11:25:19 AM
Thanks for the info
Title: Re: Ohara YouTube Embed
Post by: Suki on August 21, 2014, 11:29:28 AM
Its working just fine on my site: http://missallsunday.com/index.php?topic=21.msg3647#msg3647  and my 2.0 testing site as well.

Make sure your Sources/Subs.php has the relevant file edit. That edit is the responsible for auto embedding an url
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on August 21, 2014, 01:02:20 PM
Ok I realized the problem, basically I'd quoted those posts BEFORE installing the mod, I just quoted them again and they work, so it doesn't update previously quoted videos. But if you insert a plain quote, like:

Code: [Select]
[quote]https://www.youtube.com/watch?v=g7cjDaOQpB0[/quote]
It'll display as a plain link
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,105.html
Title: Re: Ohara YouTube Embed
Post by: Suki on August 21, 2014, 01:10:58 PM
Yes, it doesn't update previous links, it will be a lot of work for your server to handle that.

As for quoting, it fails because the regex I'm using for auto embedding uses  the first regex and the first regex won't catch that, the second does catch it though.

I will add the second regex to the auto embed function to make sure more urls are been catched.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 21, 2014, 01:43:48 PM
I just remember, I explicitly made the regex to not catch any url inside and BBC tag or anchor tags <a>, that was to prevent undesired behaviors such as auto embedding urls inside code tags, it affects quote tags too. So nope, posting a link inside any quotes or any other bbc tag won't be auto embedded.

But since I'm looking at it right now, I deleted the need to use http// or https on an url to be auto embedded.
Title: Re: Ohara YouTube Embed
Post by: Cola-Coca on August 25, 2014, 09:33:43 AM
Hi,

I have a problem with these mod, precisely with youtube. When I put the youtube link between youtube bbc I have a problem if youtube link has "s", example: https but if there is no "s" then everything works normally. Please help me!
Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2014, 10:29:53 AM
Use version 1.2, it has support for https
Title: Re: Ohara YouTube Embed
Post by: Cola-Coca on August 25, 2014, 10:59:35 AM
Use version 1.2, it has support for https

I just use that version and I have that in problem.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2014, 11:03:35 AM
Make sure that the OharaYTEmbed.php file was indeed replaced with the one from version 1.2.

Title: Re: Ohara YouTube Embed
Post by: Cola-Coca on August 25, 2014, 11:13:58 AM
Make sure that the OharaYTEmbed.php file was indeed replaced with the one from version 1.2.

I have never installed this mod, this is my first time. When youtube link has "https" I get this message:

#Invalid YouTube Link#
Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2014, 11:16:19 AM
Then it has nothing to do with it having https it means the url you're trying to post is marked as invalid but not necessarily because it has https.

Post the complete url you're trying to use.
Title: Re: Ohara YouTube Embed
Post by: Cola-Coca on August 25, 2014, 11:28:24 AM
Then it has nothing to do with it having https it means the url you're trying to post is marked as invalid but not necessarily because it has https.

Post the complete url you're trying to use.

This is just one example:
https://www.youtube.com/watch?v=nnqBJnYGObU

Link is normal but has "https" and therefore I see a message:
#Invalid YouTube Link#
If I delete "s" if it stays just like this "https:" everything is OK.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2014, 11:30:33 AM
It parses just fine on my site and my test sites, again, you need to make sure you're indeed using version 1.2.
Title: Re: Ohara YouTube Embed
Post by: Cola-Coca on August 25, 2014, 11:51:12 AM
It parses just fine on my site and my test sites, again, you need to make sure you're indeed using version 1.2.

This package I installed (see attac.):
Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2014, 12:51:31 PM
That doesn't make any sense.  1.2 supports https, the seconde regex won't even care for http or https.
I still believe you're trying to use some weird youtube url but unless you post the exact url here, there isn't anything I cna do.
Title: Re: Ohara YouTube Embed
Post by: -Captain Ghost- on August 25, 2014, 10:18:55 PM
Hello,

First of all thanks for great mod.No problem with it's functionality.
But one request that can you please do something for making posted youtube responsive

Thanks
Title: Re: Ohara YouTube Embed
Post by: Suki on August 26, 2014, 07:35:27 PM
Sure.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 27, 2014, 02:21:49 PM
Ok, I implemented it, just keep in mind that it needs to have a full responsive theme, if you're theme is based on the default theme, this will not work properly.
Title: Re: Ohara YouTube Embed
Post by: -Captain Ghost- on August 27, 2014, 08:37:31 PM
Ok, I implemented it, just keep in mind that it needs to have a full responsive theme, if you're theme is based on the default theme, this will not work properly.
No problem as there exist a  full responsive theme.

Thanks
Title: Re: Ohara YouTube Embed
Post by: Suki on August 28, 2014, 03:11:33 PM
Actually, having this creates a lot of issues, specially when viewing a topic on a really large screen.  This bit of css matches the whole size of the screen, meaning that you will end up with a video as large as the actual screen, that looks pretty weird on desktops...  I know it shouldn't be an issue on smaller screens but for desktop ones it really feels rather weird having a huge video screen.

Using css @media will sove this but then again I no longer trust $context['html_headers'] since mod authors use it wrongly so this will be implemented only on the version compatible with SMF 2.1.  Will post simple instructions for people who still want to have this.
Title: Re: Ohara YouTube Embed
Post by: akbora on August 30, 2014, 06:45:45 AM
Your mod new version however centered videos at all topics other vbgamer's mod videos. How can we correct?
Title: Re: Ohara YouTube Embed
Post by: Suki on September 01, 2014, 01:05:40 PM
Don't really understand what you're asking, sorry.  If you want to remove the centering, then find all instances if this code:

Code: [Select]
<div style="margin:auto; text-align:center;">

and replace them with this:

Code: [Select]
<div>

On your Sources/OharaYTEmbed.php file.
Title: Re: Ohara YouTube Embed
Post by: akbora on September 01, 2014, 05:32:34 PM
Sorry for my bad english.

Let me explain:

When your mod I installed other all videos  centered and set your width height measure. For example my vbgmaer's mod videos measure 550x410 this setting converts to your measure.
Title: Re: Ohara YouTube Embed
Post by: Suki on September 02, 2014, 11:31:09 AM
The css bits and the width and height are specifically hardcoded into the iframe to avoid this kind of thing.

Perhaps theres an overlap of this mod and another video embed mod, in that case there isn't much I can do to avoid the overlapping as I have no idea how other mods work.

I suggest you not to use 2 different mods for the same purpose, if the other mod alreadyhas support for youtube and vimeo then you don't have to use this one.
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on September 10, 2014, 09:31:07 PM
Hi any updates on the vimeo URL? Thanks
Title: Re: Ohara YouTube Embed
Post by: Suki on September 11, 2014, 09:10:42 AM
I'm sorry, what was the specific issue?

There was several and I fixed a few but there are other cases that cannot be fixed. a link inside a quote won't be converted to a video, any link inside any other tag won't be converted either.
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on September 11, 2014, 12:26:43 PM
Being able to customize the vimeo URL to remove the

Code: [Select]
webkitallowfullscreen mozallowfullscreen
and change

Code: [Select]
frameborder="0"
to

Code: [Select]
style="border: none;"
so that its valid HTML5. I can do this already on the youtube URLs, just need this for vimeo. Thanks.

Also is there a chance to make an exception for the video embeds within other BBC? I know it won't work for a quote but I have the spoiler BBC tag and it would be super useful for putting a collection of videos into a spoiler rather than a huge list on a page. Here's the mod in question:

http://custom.simplemachines.org/mods/?mod=2330

Code: [Select]
[spoiler][/spoiler]
Title: Re: Ohara YouTube Embed
Post by: Suki on September 11, 2014, 02:01:23 PM
If you have a test site, I can provide you with a beta of the next version, this package still contains the webkitallowfullscreen mozallowfullscreen but its a lot more easier to find and delete. I'm tempted to just remove that completely too.

As for videos inside tags, you could always use the normal youtube or vimeo tag for that, I can add a spoiler exception right in the middle of the auto-embed regex but that will cause more issues than anything and ultimately, people will start to ask for more exceptions.
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on September 11, 2014, 02:19:28 PM
If you have a test site, I can provide you with a beta of the next version, this package still contains the webkitallowfullscreen mozallowfullscreen but its a lot more easier to find and delete. I'm tempted to just remove that completely too.

Yeah I have a test site with this installed so I could just install it there if need be.

Quote
As for videos inside tags, you could always use the normal youtube or vimeo tag for that, I can add a spoiler exception right in the middle of the auto-embed regex but that will cause more issues than anything and ultimately, people will start to ask for more exceptions.

So like this?

Code: [Select]
[spoiler][youtube][/youtube][/spoiler]
If you can add it to the regex but not actually release it with the [spoiler] thing and I can just manually edit it in for my site alone would that be possible?
Title: Re: Ohara YouTube Embed
Post by: Suki on September 11, 2014, 03:33:03 PM
Its not really that simple I'm afraid

a spoiler tag not always is composed of this tags alone
Code: [Select]
[spoiler][youtube][/youtube][/spoiler]

The vast majority of spoilers allows params like:

Code: [Select]
[spoiler=inline][/spoiler]
or something like that and adding all those permutations to the regex and still exclude everything else is somehow complicated. 

Matching the cases you want to match is easy, it gets complicated when you also include stuff that you don't want to match and it gets even more complicated if you have cases you want to match inside cases you don't want to match or the other way around :P

So really, the best way to play a video inside any tag is by using the appropriated tags.
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on September 11, 2014, 03:38:24 PM
That mod only has [spoiler][/spoiler] and no params

I understand what you mean though, yes.
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on September 16, 2014, 06:53:40 PM
Installed in 2.0.8 just fine.
But does not show in text editor in non default.

What edits are required to have it work on other theme since it didn't take on the install.
There were check boxes for the theme I am using but after install no errors, but doesn't show in editor.


Thanks.
Title: Re: Ohara YouTube Embed
Post by: Suki on September 16, 2014, 06:58:50 PM
Just going to quote whats on the first post of this topic, the mod description and the page that appears right before installing it:


Attention:
On install make sure to mark the "Install in Other Themes" checkbox.

If you didn't want to follow that then you will have to manually upload via FTp or similar the youtube and vimeo images to the bbc folder inside the images folder of whatever theme you're using.
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on September 16, 2014, 07:02:26 PM
Yes, lol as my response had said ... they were checked :-)

Hence why I am writing for some assistance.

Thank You.
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on September 16, 2014, 07:07:06 PM
I decided to uninstall it and go with another developers addon .  Have a good one and thanks.
Title: Re: Ohara YouTube Embed
Post by: Suki on September 16, 2014, 07:10:29 PM
Doesn't really matter, you're going to face the same issue... all BBC mods work like that.

Anyway this is the answer if anybody else is facing the same issue:


If you didn't want to follow that then you will have to manually upload via FTp or similar the youtube and vimeo images to the bbc folder inside the images folder of whatever theme you're using.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on September 27, 2014, 02:36:22 PM
Internal Server Error

Just installed this mod and it broke my forum :(

help!

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@420connect.info and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_perl/2.0.6 Perl/v5.10.1 Server at www.420connect.info Port 80
Title: Re: Ohara YouTube Embed
Post by: Suki on September 27, 2014, 02:47:11 PM
Prob your host doesn't like SMF changing permissions to your files.

I have no idea who's your host or what kind of permissions does it need to run so I cannot really give you a straight forward answer.

Contact your host and ask them whats the proper permissions for your files, and check what are the permissions for your main index.php.

However, thats just guessing,  500 errors can also be triggered by other kinds of issues.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on September 28, 2014, 10:59:19 AM
Hi Suki,

I've checked my index.php and the permissions are correct, I use Crazy Domains for hosting but I'm not sure what to ask them (and they haven't been very helpful in the past)

Do you have a list of all edits the mod makes and I could try to find / replace them as they were. :(
Title: Re: Ohara YouTube Embed
Post by: Suki on September 28, 2014, 11:10:40 AM
Its not really about the edits, SMF modifies your main index.php  and tries to change its permissions to 777, on some paranoid host this is viewed as an attempt to break your security.

What you could do is change the permissions of your main index.php to 755 or even lower, that should get rid of the 500 problem. Unfortunately, you will face this issue  with almost every mod, even the ones that doesn't do any file edits.

Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on September 28, 2014, 11:29:50 AM
Thanks for the reply,
I've decided to just restore my most recent backup although I'll have lost some members/posts but I'd rather that, then be offline any longer

I'm going to write myself a note to back up before attempting anything that might break the forum lol!
Title: Re: Ohara YouTube Embed
Post by: Suki on September 28, 2014, 11:31:38 AM
You don't really need to do that.

Your DB has nothing to do with this.

You just need to change the permissions on your main index.php, thats all you need to do.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on September 28, 2014, 11:38:30 AM
 :-[

I need to think before I click :P
I've already deleted it etc. - more angry at myself now! lol
Title: Re: Ohara YouTube Embed
Post by: Suki on September 28, 2014, 11:41:06 AM
Your issue will still be there no matter how many back ups you restore, the issue is not within your DB.

Do you have cPanel?
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on September 28, 2014, 02:15:28 PM
Hmm

& Yes, I have crazy domain's custom cPanel.. : O:)
Title: Re: Ohara YouTube Embed
Post by: Suki on September 28, 2014, 03:01:44 PM
On your cPanel there must be a widget/feature for file handling, usually called file manager or something like that.

If you enter there, you would be able to see the main index.php file and its permissions and you will be able to change them too.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 01, 2014, 05:49:36 AM
Hi Suki,

I've finally came up with a conclusion as to what happened!

Somehow your mod is 'powerful' enough to change my whole set of file permissions and almost everything was set to 777 like you said, once it was back to 755 it began to come alive.  ;D

I'm tempted to attempt the installation of the mod again but don't want to risk breaking the forum again and not sure if it would work, once I restore my mod's back to 755 if that makes any sense?
Title: Re: Ohara YouTube Embed
Post by: Suki on October 01, 2014, 09:40:50 AM
Yeah, my mod is not really that powerful :P  its SMF packager manager and I'm afraid the same will happen with any other mods you try to install.

You could try to install this mod manually, its just a couple of file edits and the rest its just a matter of uploading a file and call it with your browser oh and upload the BBC images too. But yeah, you could try to install again and then revert back all your files to 755, however, I've seen host that shows a 500 screen right after a file has been changed so the file edits may not been done at all, thats why a manual installation will be the best route here.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 01, 2014, 01:29:07 PM
Yep that is exactly what happens to me.

As soon as I hit install it creates the 500 error,
- I've began manually adding it but have "left over files" i'm not sure where to place and i'm currently getting this error:

Fatal error: Call to undefined function OYTE_Preparse() in /home/connec31/public_html/forum/Sources/Subs.php on line 923

should I place all the files in the /forum/ folder?
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 01, 2014, 02:06:51 PM
(add them to /forum/ and still have the same error message? :()
Title: Re: Ohara YouTube Embed
Post by: Suki on October 01, 2014, 02:12:58 PM
OK, in order to manually install this mod you need to apply the following changes to your files:

http://custom.simplemachines.org/mods/index.php?action=parse;mod=3268;attach=229618;smf_version=2.0.8

after you already did the edits on

./Sources/Post.php

and

./Sources/Subs.php

Next is moving these files: you will find those files by downloading the mod and unzipping the zip archive.

Move the included directory "Themes" to "the root directory".
Move the included directory "Sources" to "the root directory".
Move the included file "youtube.gif" to "./Themes/default/images/bbc".
Move the included file "vimeo.gif" to "./Themes/default/images/bbc".

The next thing to do is installing the hooks, grab the "addHooks.php"  file and with your FTP program upload that file to your roor folder, that is, the one that has the SSI.php archive on it.

Then open youir browser, type your forum url and add this at the end:  addHooks.php


it should be like this:

myforum.com/addHooks.php

Hit enter so your browser goes to that page, if you uploaded the file to the right location, theres should be a blank page, thats normal, it means the hooks where installed.

Thats all you need to do, now the mod should be installed on your forum.  If you use a custom theme then theres a couple extra steps you need to do.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 01, 2014, 02:16:34 PM
I've already done this and now get:

Fatal error: Call to undefined function OYTE_Preparse() in /home/connec31/public_html/forum/Sources/Subs.php on line 923
when i try to load any page including /forum/addHooks.php

(and yes, I have a custom theme on)

:(
Title: Re: Ohara YouTube Embed
Post by: Suki on October 01, 2014, 02:21:31 PM
Oh, bugger.

Unfortunately, you will need to "un do" the changes on

./Sources/Post.php

and

./Sources/Subs.php

Then move the files

Then run addHooks.php

And finally, re-do the file edits.


This is because there is some logic a mod has to follow when installing a mod with hooks. Uusually the packager manager takes care of that, or rather the mod author, by moving the files, install the hooks and finally made the edits, we need to follow those exact steps and that order even for a manual installation.

Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 01, 2014, 02:23:51 PM
Thanks for the swift reply! I'll give it a go and report back! :)
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 01, 2014, 02:44:52 PM
AAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!

IT WORKSSSSSS!!!!!!!!!

Thank you! and Thank you for being patient, understanding, well educated and awesome!

*HUGS KISSES AND POSITIVE KARMA OVERLOAD*

XXXXX

:D
Title: Re: Ohara YouTube Embed
Post by: Suki on October 01, 2014, 02:59:04 PM
Cool :)
Title: Re: Ohara YouTube Embed
Post by: Aaron10 on October 01, 2014, 10:39:54 PM
Slightly off topic but if ever you do have to manually install and execute addhooks.php, how would you undo the addhooks changes if an uninstall was needed (for any mod)?
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 02, 2014, 05:48:01 AM
Not sure if this is what you're looking for but the .zip for the MOD had a removeHooks.php file too?
Title: Re: Ohara YouTube Embed
Post by: Suki on October 02, 2014, 08:52:21 AM
It depends on the mod, some mod authors has a unique file for both install and uninstall this makes it incredible difficult to manually uninstall hooks. If you upload that single file, it will not uninstall the hooks since it will have no idea if you're trying to install or uninstall, that context is given by the packager manager.  The only way to uninstall hooks its messing around with your DB or change that file to explicitly tell SMF to remove the hooks.

I prefer to have two separate files, one for install and one for uninstall, that way if you ever need to manually uninstall any of my mods, you only need to upload the removeHooks.php file and run it.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 03, 2014, 05:19:08 AM
Suki - I had the MOD working as it should.. then restored an old database and now I can't see the buttons for videos :(
Can you assist?
Title: Re: Ohara YouTube Embed
Post by: margarett on October 03, 2014, 05:34:59 AM
You are again missing the hooks. If you restored an old database backup, then the calls in smf_settings are probably gone.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on October 03, 2014, 06:08:18 AM
:D I managed to merge my smf_settings and the buttons have reappeared! :D

Thank you margarett!  8)
Title: Re: Ohara YouTube Embed
Post by: longlong on October 13, 2014, 08:05:25 AM
How to disable Ohara Youtube embed from the Shoutbox (more specifically SimplePortal's Shoutbox).

I am having this problem!
Whenever i am pasting a link into shoutbox the Ohara automatically adds [youtube][/youtube]  tags              "test 1" 
see this mp4 video  cdn.mediacru.sh/aVs2TFikaWcC.mp4 i made!

i have to add [ url][ /url] tags every time to the link so it can be shown naturally                        "test 2"

i haven't found any way to modify the Ohara or Simple Portal's Shoutbox!   and the only link i found by searching was this but no answer!
http://www.simplemachines.org/community/index.php?topic=507505.msg3585380#msg3585380
Title: Re: Ohara YouTube Embed
Post by: Suki on October 13, 2014, 09:07:26 AM
Tell the mod author of that shoutbox that they need to use the fourth parameter in parse_bbc() to only allow the tags they want to allow on their shoutbox messages.

I suppose they will only want basic text BBC, maybe urls too.

This mod shouldn't parse this kind of url: cdn.mediacru.sh/aVs2TFikaWcC.mp4 since it doesn't contain any of the things this mod looks for in a youtube or vimeo url.

Make sure you only have 1 youtube embedder, having more than one can cause issues.
Title: Re: Ohara YouTube Embed
Post by: longlong on October 13, 2014, 11:44:11 AM
Really fast answer suki thank you! I will ask the Simple's Portal mods to!
Title: Re: Ohara YouTube Embed
Post by: Suki on October 13, 2014, 12:11:26 PM
To disable the auto embedding you can remove this line form your Sources/Subs.php file:

$message = OYTE_Preparse($message);

Although doing it will remove the auto embedding everywhere.
Title: Re: Ohara YouTube Embed
Post by: Ecnelis on November 09, 2014, 12:16:11 PM
Are there any plans for embed based on id only?

Quote
[youtube]BpXMQ_S18iE[/youtube]
Title: Re: Ohara YouTube Embed
Post by: Suki on November 10, 2014, 08:37:44 AM
Not really, is not something that many people has requested and it would be too annoying having to handle urls or IDs on the same tag.

If you know the ID you only need to add youtube.com/  to it.

What would be the benefit of using only the ID?
Title: Re: Ohara YouTube Embed
Post by: Ecnelis on November 10, 2014, 12:11:40 PM
It's not for any benefits, really. I have just upgraded my SMF-based forum from 1.1.20 to 2.0.9 and the old YT plug-in is not working anymore. And it has the ID-only embed... So it's problem just with me. ;) Got to fix this manually.
Title: Re: Ohara YouTube Embed
Post by: Suki on November 10, 2014, 12:34:51 PM
oh, OK, can you point me to the old mod you used to have?
Title: Re: Ohara YouTube Embed
Post by: DanesDK on November 15, 2014, 06:35:48 PM
Hey,

Is there anyway to get this youtube video start in like 720p.???

Thanks
Title: Re: Ohara YouTube Embed
Post by: Suki on November 16, 2014, 09:05:14 AM
Open your /Sources/OharaYTEmbed.php file and find 2 instances of this:

Code: [Select]
src="http://www.youtube.com/embed/$1"

Change both of them to this:

Code: [Select]
src="http://www.youtube.com/embed/$1&vq=hd720"
Title: Re: Ohara YouTube Embed
Post by: hcfwesker on December 08, 2014, 07:06:25 PM
Are there an reported issues with the embed video not having the fullscreen option displayed in the bottom right?

http://i.gyazo.com/4761072a72a2834fc0ef8b7b7978c6b5.png

^ It shows for me in Opera browser so I never knew there was an issue until some members brought it up that they don't have the fullscreen option in browsers like chrome, firefox, IE, etc.   I checked, myself, on the browsers and sure enough the fullscreen option doesn't appear.

A quote from one of my members ...

Quote
Upon further investigation, it's an iframe in the older HTML embedding an HTML5 page that disables the full screen button. When the page returns the need to use Flash Player instead, full screen button shows.
Title: Re: Ohara YouTube Embed
Post by: Suki on December 09, 2014, 08:30:32 AM
Don't really understood you, are you reporting an issue with the mod? I can't recall any reported issue like that.

I'm not sure if there is something I can do, the iframe option is considered the best option since it selects the right tool for the user's browser.
Title: Re: Ohara YouTube Embed
Post by: Bigguy on December 09, 2014, 08:35:51 AM
I installed this yesterday on 2.1 and it all works fine. Fullscreen mode is there
Title: Re: Ohara YouTube Embed
Post by: Geor'G on December 09, 2014, 07:08:55 PM
Does not work with a long tag - http://www.youtube.com/watch?feature=player_embedded&v=[ID]
Title: Re: Ohara YouTube Embed
Post by: Suki on December 26, 2014, 12:22:19 PM
Thanks, it is fixed on the new version but thats only for SMF 2.1 will see about back porting the regex to the SMF 2.0.x compatible version.
Title: Re: Ohara YouTube Embed
Post by: karavan2 on January 31, 2015, 12:08:00 PM
[youtube]https://www.youtube.com/watch?feature=player_embedded&v=WlobIDJyyOs&x-yt-cl=85114404&x-yt-ts=1422579428[/youtube]
[youtube]https://www.youtube.com/watch?x-yt-ts=1422579428&x-yt-cl=85114404&v=fHc5nAApClI&feature=player_embedded[/youtube]
[youtube]https://www.youtube.com/watch?feature=player_embedded&v=-onkyzFraIw&x-yt-cl=85114404&x-yt-ts=1422579428[/youtube]

are not displayed, showing black Screen.

Title: Re: Ohara YouTube Embed
Post by: Suki on January 31, 2015, 12:43:29 PM
If its showing a black screen then it means you or your users cannot see those videos.

However, if you see a blank (as in nothing) screen then it means the mod didn't catch those urls but on those cases the mod should print an error message.

So which is it? a blank or a black screen?
Title: Re: Ohara YouTube Embed
Post by: karavan2 on January 31, 2015, 02:20:24 PM
http://s019.radikal.ru/i635/1501/39/12e910a93f86.jpg
http://s019.radikal.ru/i630/1501/c8/2a0ea7f1de54.jpg
After pressing play -
Text: An error has occurred, please try again later.
Title: Re: Ohara YouTube Embed
Post by: Suki on January 31, 2015, 02:22:40 PM
Then it means the videos you are trying to see are the issue.

If the mod converts the links into a video, then the mod has fulfilled its job. Some youtube videos has restrictions and this mod cannot bypass those restrictions. There is nothing I can do.
Title: Re: Ohara YouTube Embed
Post by: Myth_72 on February 17, 2015, 02:51:45 AM
I used until now other mod it's had possibility to show video from youtube only with the ID of video  like this for example
Code: [Select]
[yotube]wifH74R3yJA[youtube]but now with Ohara YouTube Embed this links aren't working.

Is there possibility to add this functionality in Ohara to show video only with ID of video?

Tanks in advance.

P.S. Sorry for my bad English.
Title: Re: Ohara YouTube Embed
Post by: Suki on February 17, 2015, 10:08:44 AM
Untested and will probably never be included since not that many people uses the ID

Open your Sources/OharaYTEmbed.php  find this:

Code: [Select]
if (empty($data))
return sprintf($txt['OYTE_unvalid_link'], 'youtube');

And add this below:

Code: [Select]

// Did the user used the ID?
if (strlen($data) == 11)
return '<iframe width="'. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'" height="'. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'" src="//www.youtube.com/embed/'. $data .'" frameborder="0"></iframe>';

Keep in mind that this relies on the user putting the exact eleven chars youtube uses, of course if youtube changes the way their Ids works, which is very likely,this will have to be updated again.
Title: Re: Ohara YouTube Embed
Post by: Myth_72 on February 24, 2015, 08:48:35 AM
Thank you very much :)
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 05, 2015, 12:58:08 PM
Can I make this mod, EXCLUDE youtube links only when said, in my SimplePortal 'shoutbox'?
(so they become [link] instead of [youtube]....[/youtube]


Many thanks
Title: Re: Ohara YouTube Embed
Post by: Suki on March 05, 2015, 06:04:27 PM
There is a fix floating around the simpleportal support topic (http://www.simplemachines.org/community/index.php?topic=227599.msg3753810#msg3753810) but I wouldn't recommend it, relying on global vars is sloppy and careless.

Simpleportal's developer should really use the $parse_tags param in their calls to parse_bbc() to only allow the bbc tags that they want instead of relying on third party mod authors to do their job for them.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 06, 2015, 12:04:38 PM
Thanks Suki!

I'll test it out for now and hopefully they make this change in a future release  O:)
Title: Re: Ohara YouTube Embed
Post by: KirkhamsEbooks on March 07, 2015, 09:18:51 PM
My Youtube icon has disappeard from the bbc code for new posts.

Any suggestions?  Using 2.0.4

Rick
Title: Re: Ohara YouTube Embed
Post by: Deaks on March 07, 2015, 09:28:07 PM
My Youtube icon has disappeard from the bbc code for new posts.

Any suggestions?  Using 2.0.4

Rick

yeh update your forum!!!
Title: Re: Ohara YouTube Embed
Post by: SaltedWeb on March 08, 2015, 01:30:52 AM
My Youtube icon has disappeard from the bbc code for new posts.

Any suggestions?  Using 2.0.4

Rick
Is the icon just gone or are the words for it missing as well ?
Title: Re: Ohara YouTube Embed
Post by: KirkhamsEbooks on March 08, 2015, 03:07:26 AM


Rick
Quote
Is the icon just gone or are the words for it missing as well ?

Updated and yes the icon and words are gone although the feature can still be used by hand.
Code: [Select]
[youtube]myvideopath[/youtube]Rick
Title: Re: Ohara YouTube Embed
Post by: Deaks on March 08, 2015, 09:17:03 AM
godsbusinessway < this site?

Still needs updated SMF is on version 2.0.9 and their have been some LARGE security patches since then.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 08, 2015, 12:43:13 PM


Rick
Quote
Is the icon just gone or are the words for it missing as well ?

Updated and yes the icon and words are gone although the feature can still be used by hand.
Code: [Select]
[youtube]myvideopath[/youtube]Rick

Download the mod, unzip it, get the addHooks.php file, upload that file to your forum's root where SSI.php is  an call it with your browser:  misite.com/forum/addHooks.php  you'll see a blank page then delete that file from your server.
Title: Re: Ohara YouTube Embed
Post by: jack_1985 on March 09, 2015, 04:45:46 AM
Hey Suki,

First off, thanks for the great work!

I have a question I hope you could help me with though. When I try to create a post with just a youtube video in it, I always receive the error message "message body was left empty".
(So I need to add extra characters or words to the message to be able to place it). Any ideas why this happens?

Thanks in advance!
Title: Re: Ohara YouTube Embed
Post by: Suki on March 09, 2015, 09:32:20 AM
You missed the code edit on Sources/Post.php

On that file find this:

<img>

and replace it with this:

<img><iframe>

Theres two instances of it so make sure you replace both.  I guess you are also missing the other edit so in your Sources/Subs.php file fine this:

// Sift out the bbc for a performance improvement.

and above that add this:

// Ohara youtube embed
   $message = OYTE_Preparse($message);



BTW the new version only compatible with SMF 2.1 makes no edits and it would be easier to add more sites.
Title: Re: Ohara YouTube Embed
Post by: jack_1985 on March 09, 2015, 11:42:52 AM
Ah, a stupid mistake from my side. Thank you for the quick response! :)
Title: Re: Ohara YouTube Embed
Post by: Suki on March 10, 2015, 01:06:38 PM
Heres a new version: 1.2.1:

New features/Bug fixes:

Auto-embed regex improved
Added the option to disable the auto-embed feature via $context['ohara_disable'].
Use closures instead of create_function()
Change the way youtube videos are displayed, faster pages specially with multiple videos, thanks to Infernuza for the tip.
previous version didn't uninstalled any Spanish language file.
Don't assume Sources is always going to be located at boardurl Dunno how many times I actually fixed this over the years...

To upgrade just uninstall the old version and install the new one or just download the package, unzip it and upload the Sources and Themes folder to your forum's root dir.

For those brave souls testing SMF 2.1 there is also a new version (https://github.com/MissAllSunday/OharaYouTubeEmbed/releases/tag/v2.0), only compatible with it, some of the new features:

Full OOP approach using the Ohara helper class.
Regex improvements.
Drop compatibility with SMF 2.0.x
Add compatibility with SMF 2.1
Add a setting to disable auto-embedding.
Auto-embed regex improved
Added the option to disable the auto-embed feature via $context['ohara_disable'].
Schema-less urls
Change the way youtube videos are displayed, faster pages specially with multiple videos, thanks to Infernuza for the tip.
No file edits.

It was almost completely re-written. It now allows more sites to be added easily (just upload a class file to the Sources/OharaYTEmbed and any other extra css/bbc image/js files to their respective folders), this is also the first mod to use my helper class which aims to normalize all my mods and code in general.

The first link in the downloads section is a ready to install package. Using the "source code" links will result in a failed and bogus installation since this mod relies on third party git repos to work properly.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 10, 2015, 04:53:11 PM
Thanks for the update Suki! :)

Just wondering if:
" Added the option to disable the autoembed feature via $context['ohara_disable']."

relates to the SP shoutbox link issue I had a few days ago?
Title: Re: Ohara YouTube Embed
Post by: Obcy on March 11, 2015, 08:56:06 AM
Hey Suki,

First off, thanks for the great work!

I have a question I hope you could help me with though. When I try to create a post with just a youtube video in it, I always receive the error message "message body was left empty".
(So I need to add extra characters or words to the message to be able to place it). Any ideas why this happens?

Thanks in advance!
The problem still exists version 1.2.1
Title: Re: Ohara YouTube Embed
Post by: Suki on March 11, 2015, 10:22:55 AM
Thanks for the update Suki! :)

Just wondering if:
" Added the option to disable the autoembed feature via $context['ohara_disable']."

relates to the SP shoutbox link issue I had a few days ago?

Yes.

Hey Suki,

First off, thanks for the great work!

I have a question I hope you could help me with though. When I try to create a post with just a youtube video in it, I always receive the error message "message body was left empty".
(So I need to add extra characters or words to the message to be able to place it). Any ideas why this happens?

Thanks in advance!
The problem still exists version 1.2.1

And it will continue to exists if you missed the file edits this mod does... the issue is not within the mod but rather your installation failed to do the necessary file edits.
Title: Re: Ohara YouTube Embed
Post by: Obcy on March 11, 2015, 10:50:32 AM
Tested fresh install.
I checked all the correct installation of hand.
Error still exist.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 11, 2015, 11:07:53 AM
Please double check that you have indeed the code edits listed at: http://custom.simplemachines.org/mods/index.php?action=parse;mod=3268;attach=240866;smf_version=2.0.9

The package manager could show no errors during installs and still fail to do the edits on weird server configurations so a manual check needs to be done to make sure the proper file edits were done.


edit,
Oh my! I forgot the youtube BBC now gets added with a div instead of an iframe....  meh... I will release a new version shortly. To manually fix this just search for

<img><iframe>

in Sources/Post.php and replace it with:

<img><iframe><div>

on both locations.
Title: Re: Ohara YouTube Embed
Post by: Obcy on March 11, 2015, 11:30:49 AM
Thank you very much works ; )
Title: Re: Ohara YouTube Embed
Post by: Obcy on March 13, 2015, 06:51:58 AM
Sources/Subs-Portal.php
Code: (Find) [Select]
$context['aeva_disable'] = true;
Code: (Replace) [Select]
$context['aeva_disable'] = true;
$context['ohara_disable'] = true;

Not working. Put  link in simpleportal 2.3.6 shoutbox   not visible.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 13, 2015, 09:32:03 AM
If you cannot see the actual video then its working as it should, that edit is for disabling turning youtube links into videos on the shoutbox.
Title: Re: Ohara YouTube Embed
Post by: Obcy on March 13, 2015, 10:12:51 AM
Nothing create .(https://dl.dropboxusercontent.com/u/17000521/Forum/bad.jpg)

This happens when the option is($context['aeva_disable'] = true;), and there is no option.

And should ?

(https://dl.dropboxusercontent.com/u/17000521/Forum/good.jpg)





Title: Re: Ohara YouTube Embed
Post by: Suki on March 13, 2015, 10:16:36 AM
I don't really understand what you are trying to do here.

That code is for preventing links been parsed as videos on your shoutbox. If you put a link there and it doesn't get converted to a video then the mod is working as it should.
Title: Re: Ohara YouTube Embed
Post by: Obcy on March 13, 2015, 10:24:31 AM
Sorry for my english. Its feature not bug ok.

 Its posible to  parsed
(https://dl.dropboxusercontent.com/u/17000521/Forum/good.jpg)
Title: Re: Ohara YouTube Embed
Post by: Suki on March 13, 2015, 10:42:58 AM
So, do you want the actual videos to appear in your shoutbox?
Title: Re: Ohara YouTube Embed
Post by: Obcy on March 13, 2015, 11:12:13 AM
Now it is empty if you paste the youtube link.  I want to be like the other links in shoutbox.
Title: Re: Ohara YouTube Embed
Post by: Obcy on March 14, 2015, 01:18:27 PM
video demonstrate problem
https://www.youtube.com/watch?v=pigC6D2KR8M
Title: Re: Ohara YouTube Embed
Post by: karavan2 on March 14, 2015, 03:20:36 PM
Probably on this matter follows will address to the author of a shoutbox mod but not Mr. Suki.
Title: Re: Ohara YouTube Embed
Post by: willyvmm on March 26, 2015, 12:10:27 PM
Hi.
Does i missed something or this mod does not display Thumbnails for YT videos ?
Title: Re: Ohara YouTube Embed
Post by: Suki on March 26, 2015, 01:51:19 PM
Some youtube videos does not have a generic thumbnail, specially old ones.

The only way to make every video to display a thumbnail would be to use youtube api and thats something I rather prefer to avoid because:

- Its annoying and not that many admins would know how to create their own. can't create a unique app for everyone since there are limits and people will be locked out.
- APIs from big names like facebook, twitter or google changes every now and then, I cannot keep up with that.

I can post some instructions on how to call to the API and retrieve the thumbnail but I won't be adding that feature.


It also looks like you missed to place the oharaEmbed.css file in your theme's css folder, that file is needed to render the videos correctly.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 26, 2015, 01:57:44 PM
Also updated the file to fix a missing edit.

For those who downloaded the previous version and want to manually fix this:

Search for

<img><iframe>

in Sources/Post.php and replace it with:

<img><iframe><div>

on both locations.
Title: Re: Ohara YouTube Embed
Post by: willyvmm on March 26, 2015, 02:26:41 PM
Thanks.
I put the css on place :)

I did'nt know about the mising generic thumbnail. With another video everytnhing seems to be ok.

I changed the sddefault.jpg to hqdefault.jpg and it seems to did the job
Title: Re: Ohara YouTube Embed
Post by: Suki on March 26, 2015, 02:42:44 PM
Thats a nice idea! to check for either sddefault or hqdefault, will implement it when I have some time, thanks.
Title: Re: Ohara YouTube Embed
Post by: lurkalot on March 28, 2015, 02:25:21 PM
I seem to be getting an error in the log each time I click the new topic button, or reply button.  Using the latest version Ohara YouTube Embed 1.2.1  And the tooltip is missing from the vimeo bbc button.

Code: [Select]
http://guitaristguild.com/index.php?action=post;board=29.0
8: Undefined index: OYTE_vimeo_desc
File: /home1/camcra24/xxxxxx_xxx/Sources/OharaYTEmbed.php
Line: 107
Title: Re: Ohara YouTube Embed
Post by: Suki on March 28, 2015, 04:04:27 PM
Ah yet another thing to fix, thanks for the report.
Title: Re: Ohara YouTube Embed
Post by: dave87 on March 28, 2015, 06:12:44 PM
Hi I'm having an issue with this modification on my website. Everything installed correctly and seems to work yet when a video is posted all that appears is the default grey youtube box with play button
Title: Re: Ohara YouTube Embed
Post by: briggz5d on March 29, 2015, 12:56:22 AM
HI,
I have the same problem as willy, thumbnail does show in some videos but not all, what css was copied from where to where?
What sddefault and hqdefault - where are these edits done?

Another issue is that i replaced this mod with my previous av lite which auto-embeds youtu.be links, going to every video on my forum to add the new youtube tags would be a pain.
How can i set it to autoembed youtu.be links?
Title: Re: Ohara YouTube Embed
Post by: Suki on March 29, 2015, 01:44:34 PM
Hi I'm having an issue with this modification on my website. Everything installed correctly and seems to work yet when a video is posted all that appears is the default grey youtube box with play button

Thats the expected behavior, youtube videos are now loading on demand, that is, when you click on them. Some videos do not have a preview image thats why you see a gray play button instead. Gotta do something about it it seems.

What happen when you click on the video?

HI,
I have the same problem as willy, thumbnail does show in some videos but not all, what css was copied from where to where?
What sddefault and hqdefault - where are these edits done?


The css file is called oharaEmbed.css and its suppose to be in your themes css folder.

The call to sddefault is located at Themes/default/scripts/ohyoutube.js  jsut search for that word and replace it with hqdefault and see if that helps, that file is minimized so its dificult to add another conditional to check for both images, will have to do that on a new release.

Another issue is that i replaced this mod with my previous av lite which auto-embeds youtu.be links, going to every video on my forum to add the new youtube tags would be a pain.
How can i set it to autoembed youtu.be links?

Well, if you are no longer using this mod then I cannot really help you, you need to talk to whoever wrote the other mod you are using.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 30, 2015, 12:24:49 PM
Could you please expand further on how to use the new added $context['ohara_disable'] to have the mod disabled in SP

Using the second part of the how to, you linked to (http://www.simplemachines.org/community/index.php?topic=227599.msg3753810#msg3753810) before doesn't seem to have the effect anymore with the new version  :'(




edit;


It seems using http:// doesn't display but starting www. does?
Title: Re: Ohara YouTube Embed
Post by: lurkalot on March 30, 2015, 12:27:49 PM
Ah yet another thing to fix, thanks for the report.

No problem.  I have another one now though,

Has youtube changed something?  for some reason all my youtube vids no longer play.  Shows the image, but no play button etc. Here's an example,  http://guitaristguild.com/index.php?topic=727.0  pretty sure they were all working yesterday.

Using Ohara YouTube Embed 1.2.1
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 30, 2015, 12:29:04 PM
Ah yet another thing to fix, thanks for the report.

No problem.  I have another one now though,

Has youtube changed something?  for some reason all my youtube vids no longer play.  Shows the image, but no play button etc. Here's an example,  http://guitaristguild.com/index.php?topic=727.0  pretty sure they were all working yesterday.

Using Ohara YouTube Embed 1.2.1

You need to click the video now!
Title: Re: Ohara YouTube Embed
Post by: lurkalot on March 30, 2015, 12:34:20 PM

You need to click the video now!


Thanks.  Trouble is (on my site) they aren't clickable, at least not for me in Chrome IE11 or firefox.  They work if I go directly on youtube though,
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 30, 2015, 12:39:43 PM

You need to click the video now!


Thanks.  Trouble is (on my site) they aren't clickable, at least not for me in Chrome IE11 or firefox.  They work if I go directly on youtube though,

Just tested it for myself and yeah, you only seem to be grabbing the picture/placeholder and lacking any actual video features for me too - strange!?
Title: Re: Ohara YouTube Embed
Post by: Suki on March 30, 2015, 12:45:19 PM
Could you please expand further on how to use the new added $context['ohara_disable'] to have the mod disabled in SP

Using the second part of the how to, you linked to (http://www.simplemachines.org/community/index.php?topic=227599.msg3753810#msg3753810) before doesn't seem to have the effect anymore with the new version  :'(




edit;


It seems using http:// doesn't display but starting www. does?


It depends on the portal you are using, all $context['ohara_disable'] does is end up the function before the links gets parsed, it depends on whatever portal you are using to set $context['ohara_disable'] to true, this mod alone cannot "known" if you are using a portal or a shoutbox.

Keep in mind that $context['ohara_disable'] only works for the autoembed feature, normal videos posted using the youtube tags will not be affected by this.

I cannot understand your second question, display what exactly?


Ah yet another thing to fix, thanks for the report.

No problem.  I have another one now though,

Has youtube changed something?  for some reason all my youtube vids no longer play.  Shows the image, but no play button etc. Here's an example,  http://guitaristguild.com/index.php?topic=727.0  pretty sure they were all working yesterday.

Using Ohara YouTube Embed 1.2.1

The mod absolutely needs this css file to work:  http://guitaristguild.com/Themes/GrayStyle/css/oharaEmbed.css  your site doesn't have it.

Get the mod, unzip it, get the css file and just upload that file to that path.
Title: Re: Ohara YouTube Embed
Post by: lurkalot on March 30, 2015, 12:58:26 PM

The mod absolutely needs this css file to work:  http://guitaristguild.com/Themes/GrayStyle/css/oharaEmbed.css  your site doesn't have it.

Get the mod, unzip it, get the css file and just upload that file to that path.

Thanks, not sure why it was missing, I checked the other themes on install.  Anyway, uploaded and now have a play button, but still doesn't do anything.  Does this mean I have something else missing?
Title: Re: Ohara YouTube Embed
Post by: Suki on March 30, 2015, 01:07:39 PM

The mod absolutely needs this css file to work:  http://guitaristguild.com/Themes/GrayStyle/css/oharaEmbed.css  your site doesn't have it.

Get the mod, unzip it, get the css file and just upload that file to that path.

Thanks, not sure why it was missing, I checked the other themes on install.  Anyway, uploaded and now have a play button, but still doesn't do anything.  Does this mean I have something else missing?

Yep, there is another issue, for some reason jquery is complaining about this bit:

$(document).on("click","#"+this.id,function(a)  which is the click event that loads the actual video and plays it.

I suppose I will have to change it to a more friendly ID, will check this further today and get a fix for this alone with the other ones already reported.
Title: Re: Ohara YouTube Embed
Post by: lurkalot on March 30, 2015, 01:09:12 PM

The mod absolutely needs this css file to work:  http://guitaristguild.com/Themes/GrayStyle/css/oharaEmbed.css  your site doesn't have it.

Get the mod, unzip it, get the css file and just upload that file to that path.

Thanks, not sure why it was missing, I checked the other themes on install.  Anyway, uploaded and now have a play button, but still doesn't do anything.  Does this mean I have something else missing?

Yep, there is another issue, for some reason jquery is complaining about this bit:

$(document).on("click","#"+this.id,function(a)  which is the click event that loads the actual video and plays it.

I suppose I will have to change it to a more friendly ID, will check this further today and get a fix for this alone with the other ones already reported.

Thank you.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 30, 2015, 04:59:04 PM
Could you please expand further on how to use the new added $context['ohara_disable'] to have the mod disabled in SP

Using the second part of the how to, you linked to (http://www.simplemachines.org/community/index.php?topic=227599.msg3753810#msg3753810) before doesn't seem to have the effect anymore with the new version  :'(




edit;


It seems using http:// doesn't display but starting www. does?


It depends on the portal you are using, all $context['ohara_disable'] does is end up the function before the links gets parsed, it depends on whatever portal you are using to set $context['ohara_disable'] to true, this mod alone cannot "known" if you are using a portal or a shoutbox.

Keep in mind that $context['ohara_disable'] only works for the autoembed feature, normal videos posted using the youtube tags will not be affected by this.

I cannot understand your second question, display what exactly?
[/quote]

Sorry, I believe this is where someone before me found it hard to explain the situation..

I'll try my best :P

when you use a http://www.youtube.... link on a simple portal shoutbox and hit enter, .. the shoutbox refreshes as if you had posted but no post is actually posted/displayed/"shouted" but it does work (turns the YT link into [link] and doesn't wrap tags around with youtube links starting with www.

Taking a random shot, I'd guess it's a regex thing but I could be miles off  O:)

Hopefully that makes sense!  :-*
Title: Re: Ohara YouTube Embed
Post by: Suki on April 01, 2015, 06:50:28 PM
Sorry, I believe this is where someone before me found it hard to explain the situation..

I'll try my best :P

when you use a http://www.youtube.... link on a simple portal shoutbox and hit enter, .. the shoutbox refreshes as if you had posted but no post is actually posted/displayed/"shouted" but it does work (turns the YT link into [link] and doesn't wrap tags around with youtube links starting with www.

Taking a random shot, I'd guess it's a regex thing but I could be miles off  O:)

Hopefully that makes sense!  :-*

Sorry I still cannot understand what you mean. 
so, the mod works with www but not when using http://www  ?  is that what you are trying to say?

Can you post some screenshots of your problem?
Title: Re: Ohara YouTube Embed
Post by: Suki on April 01, 2015, 07:39:21 PM
@lurkalot Can you please do the following changes and test if that solves your issues?

On your Sources/OharaYTEmbed.php file

find this:

Code: [Select]
$result = '<div class="youtube" id="'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
and replace with this:

$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';

Now replace the entire Themes/default/scripts/ohyoutube.js  file with this:

Code: [Select]
/*
 Copyright (c) 2015 Jessica González
 @license http://www.mozilla.org/MPL/MPL-1.1.html
*/

function oh_main(){$(".youtube").each(function(){videoID=this.id.replace("oh_","");imgsrc=oh_getImage(videoID);imgHeight=$(this).height();imgWidth=$(this).width();"undefined"!==typeof imgsrc&&$(this).css({"background-image":"url("+imgsrc+")","background-size":"cover"});$(this).append($("<div/>",{"class":"youtube_play"}));$("#oh_"+videoID).on("click",function(){var a="https://www.youtube.com/embed/"+videoID+"?autoplay=1&autohide=1";$(this).data("params")&&(a+="&"+$(this).data("params"));a=$("<iframe/>",
{frameborder:"0",src:a,width:imgWidth,height:imgHeight});$(this).replaceWith(a)})})}function oh_getImage(a){var b="",c,d,e=["maxresdefault","sddefault","mqdefault","hqdefault","default"];c=0;for(d=e.length;c<d&&(b="http://i.ytimg.com/vi/"+a+"/"+e[c]+".jpg",0==b.width);++c);return b}function oh_getUrl(a){var b=window.location.search.substring(1);if(-1<b.indexOf(a))return!0;for(var b=b.split(";"),c=0;c<b.length;c++)if(b[c].split("=")[0]==a)return!0}oh_main();
if(oh_getUrl("post"))$("input[name=preview]").on("click",function(){setTimeout(function(){oh_main()},3E3)});
Title: Re: Ohara YouTube Embed
Post by: lurkalot on April 02, 2015, 03:33:19 AM
@lurkalot Can you please do the following changes and test if that solves your issues?

On your Sources/OharaYTEmbed.php file

find this:

Code: [Select]
$result = '<div class="youtube" id="'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
and replace with this:

$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';

Now replace the entire Themes/default/scripts/ohyoutube.js  file with this:

Code: [Select]
/*
 Copyright (c) 2015 Jessica González
 @license http://www.mozilla.org/MPL/MPL-1.1.html
*/

function oh_main(){$(".youtube").each(function(){videoID=this.id.replace("oh_","");imgsrc=oh_getImage(videoID);imgHeight=$(this).height();imgWidth=$(this).width();"undefined"!==typeof imgsrc&&$(this).css({"background-image":"url("+imgsrc+")","background-size":"cover"});$(this).append($("<div/>",{"class":"youtube_play"}));$("#oh_"+videoID).on("click",function(){var a="https://www.youtube.com/embed/"+videoID+"?autoplay=1&autohide=1";$(this).data("params")&&(a+="&"+$(this).data("params"));a=$("<iframe/>",
{frameborder:"0",src:a,width:imgWidth,height:imgHeight});$(this).replaceWith(a)})})}function oh_getImage(a){var b="",c,d,e=["maxresdefault","sddefault","mqdefault","hqdefault","default"];c=0;for(d=e.length;c<d&&(b="http://i.ytimg.com/vi/"+a+"/"+e[c]+".jpg",0==b.width);++c);return b}function oh_getUrl(a){var b=window.location.search.substring(1);if(-1<b.indexOf(a))return!0;for(var b=b.split(";"),c=0;c<b.length;c++)if(b[c].split("=")[0]==a)return!0}oh_main();
if(oh_getUrl("post"))$("input[name=preview]").on("click",function(){setTimeout(function(){oh_main()},3E3)});

Suki, thanks, done the edits, but all I'm getting is a black box where the video should be, and although it looks clickable it doesn't do anything.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on April 02, 2015, 09:58:13 AM
Sorry, I believe this is where someone before me found it hard to explain the situation..

I'll try my best :P

when you use a http://www.youtube.... link on a simple portal shoutbox and hit enter, .. the shoutbox refreshes as if you had posted but no post is actually posted/displayed/"shouted" but it does work (turns the YT link into [link] and doesn't wrap tags around with youtube links starting with www.

Taking a random shot, I'd guess it's a regex thing but I could be miles off  O:)

Hopefully that makes sense!  :-*

Sorry I still cannot understand what you mean. 
so, the mod works with www but not when using http://www  ?  is that what you are trying to say?

Can you post some screenshots of your problem?


Correct.

using an address beginning with http://www doesn't work.

(I've actually since reverted to the old version of Ohara YT Embed since it seemed to do everything I needed (with the changes for SP shoutbox applied))
Title: Re: Ohara YouTube Embed
Post by: Suki on April 02, 2015, 10:35:49 AM
@lurkalot Can you please do the following changes and test if that solves your issues?

On your Sources/OharaYTEmbed.php file

find this:

Code: [Select]
$result = '<div class="youtube" id="'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
and replace with this:

$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';

Now replace the entire Themes/default/scripts/ohyoutube.js  file with this:

Code: [Select]
/*
 Copyright (c) 2015 Jessica González
 @license http://www.mozilla.org/MPL/MPL-1.1.html
*/

function oh_main(){$(".youtube").each(function(){videoID=this.id.replace("oh_","");imgsrc=oh_getImage(videoID);imgHeight=$(this).height();imgWidth=$(this).width();"undefined"!==typeof imgsrc&&$(this).css({"background-image":"url("+imgsrc+")","background-size":"cover"});$(this).append($("<div/>",{"class":"youtube_play"}));$("#oh_"+videoID).on("click",function(){var a="https://www.youtube.com/embed/"+videoID+"?autoplay=1&autohide=1";$(this).data("params")&&(a+="&"+$(this).data("params"));a=$("<iframe/>",
{frameborder:"0",src:a,width:imgWidth,height:imgHeight});$(this).replaceWith(a)})})}function oh_getImage(a){var b="",c,d,e=["maxresdefault","sddefault","mqdefault","hqdefault","default"];c=0;for(d=e.length;c<d&&(b="http://i.ytimg.com/vi/"+a+"/"+e[c]+".jpg",0==b.width);++c);return b}function oh_getUrl(a){var b=window.location.search.substring(1);if(-1<b.indexOf(a))return!0;for(var b=b.split(";"),c=0;c<b.length;c++)if(b[c].split("=")[0]==a)return!0}oh_main();
if(oh_getUrl("post"))$("input[name=preview]").on("click",function(){setTimeout(function(){oh_main()},3E3)});

Suki, thanks, done the edits, but all I'm getting is a black box where the video should be, and although it looks clickable it doesn't do anything.

Something is preventing the ohyoutube.js file from executing, can be a jquery conflict or other js error somewhere.  Does it happens with all embedded videos?

Can you disable the sharethis mod and see if that helps?
Title: Re: Ohara YouTube Embed
Post by: Suki on April 02, 2015, 10:36:18 AM
Sorry, I believe this is where someone before me found it hard to explain the situation..

I'll try my best :P

when you use a http://www.youtube.... link on a simple portal shoutbox and hit enter, .. the shoutbox refreshes as if you had posted but no post is actually posted/displayed/"shouted" but it does work (turns the YT link into [link] and doesn't wrap tags around with youtube links starting with www.

Taking a random shot, I'd guess it's a regex thing but I could be miles off  O:)

Hopefully that makes sense!  :-*

Sorry I still cannot understand what you mean. 
so, the mod works with www but not when using http://www  ?  is that what you are trying to say?

Can you post some screenshots of your problem?


Correct.

using an address beginning with http://www doesn't work.

(I've actually since reverted to the old version of Ohara YT Embed since it seemed to do everything I needed (with the changes for SP shoutbox applied))

Does it happen on normal messages too?
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on April 02, 2015, 03:48:11 PM
Sorry, I can't reproduce it anymore as I've reverted to the older version etc.

(Glad I even have a functional site at after todays events, So I probably won't try updating for a while but that's another story lol!)

If you've a test site; simple portal (with shoutbox) and Ohara .. You should be able to reproduce it if you'd like to have a look..
Title: Re: Ohara YouTube Embed
Post by: lurkalot on April 03, 2015, 04:24:26 AM

Something is preventing the ohyoutube.js file from executing, can be a jquery conflict or other js error somewhere.  Does it happens with all embedded videos?

Can you disable the sharethis mod and see if that helps?

Tried that but still not working, so I'm going to rebuild my guitarist guild site, and see which mod is causing the problem at the same time.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 04, 2015, 01:31:54 PM
Sorry, I can't reproduce it anymore as I've reverted to the older version etc.

(Glad I even have a functional site at after todays events, So I probably won't try updating for a while but that's another story lol!)

If you've a test site; simple portal (with shoutbox) and Ohara .. You should be able to reproduce it if you'd like to have a look..

Just tested this  with a random youtube video:

with http : https://www.youtube.com/watch?v=otCpCn0l4Wo  shows the link word
without http:  www.youtube.com/watch?v=otCpCn0l4Wo   shows the link word too
without https:  http://www.youtube.com/watch?v=otCpCn0l4Wo  also shows the link word

So I really don't know whats the issue here.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on April 04, 2015, 02:00:29 PM
Is this after editing any code further or just with the 2 mods installed?


That seems to be as it should?!

Perhaps I was trying to apply the 'fix' to an already 'fixed' version.. :S
Title: Re: Ohara YouTube Embed
Post by: Suki on April 04, 2015, 02:33:20 PM
Installed both mods did the edit on Subs-Portal.php, set up a shoutbox and pasted the different links, thats all I did.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on April 04, 2015, 03:37:50 PM
Installed both mods did the edit on Subs-Portal.php, set up a shoutbox and pasted the different links, thats all I did.

I see!
Like I said, I'm more than happy with how I have it set up for now but thank you for looking into this!
Title: Re: Ohara YouTube Embed
Post by: Suki on April 04, 2015, 03:49:27 PM
Its not just for you, I take the time to investigate whatever bug it was reported, I also cannot reproduce this:

I seem to be getting an error in the log each time I click the new topic button, or reply button.  Using the latest version Ohara YouTube Embed 1.2.1  And the tooltip is missing from the vimeo bbc button.

Code: [Select]
http://guitaristguild.com/index.php?action=post;board=29.0
8: Undefined index: OYTE_vimeo_desc
File: /home1/camcra24/xxxxxx_xxx/Sources/OharaYTEmbed.php
Line: 107

That text string is present in version 1.2.1 and function OYTE_bbc_add_button(&$buttons)  does load the mod's language file.

That was probable a leftover from previous versions or somehow the language files wasn't copied when the mod was installed.

What I did solve was the missing thumbnail, now the mod checks more images and not just the sddefault one. While this isn't 100% effective, it does show a lot more thumbnails, a demo can be found at my site:

http://missallsunday.com/index.php?topic=21.msg4264

Which also demonstrates the speed improvements of this new version when posting several videos per page.

Also added a few js functions to help mod authors to re-run the main youtube function for newly added DOM elements (message previews, posting via ajax, chats, etc), I myself will use this for Breeze.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 04, 2015, 04:36:29 PM
@lurkalot  While testing the new version I came across a similar issue of yours. The videos just didn't play even though there was no js error or a jquery conflict. It seems the main funciton was been executed way before the dom was ready. Applying a jquery "on document ready" seems to fix this, can you please test it to see if this also fixes your issue?

Replace the entire  Themes/default/scripts/ohyoutube.js with this:

Code: [Select]
/*
 Copyright (c) 2015 Jessica González
 @license http://www.mozilla.org/MPL/MPL-1.1.html
*/

function oh_main(){

$('.youtube').each(function() {

var videoID = this.id.replace('oh_',''),
imgsrc = oh_getImage(videoID),
imgHeight = $(this).height(),
imgWidth = $(this).width();

if (typeof imgsrc !== 'undefined'){
$(this).css({'background-image': 'url('+ imgsrc +')', 'background-size': 'cover'});
}

$(this).append($('<div/>', {'class': 'youtube_play'}));

$('#oh_'+videoID).on('click', function() {
var iframe_url = 'https://www.youtube.com/embed/' + videoID + '?autoplay=1&autohide=1';
if ($(this).data('params')) iframe_url+='&'+$(this).data('params');

// The height and width of the iFrame should be the same as parent
var iframe = $('<iframe/>', {'frameborder': '0', 'src': iframe_url, 'width': imgWidth, 'height': imgHeight })

// Replace the YouTube thumbnail with YouTube HTML5 Player
$(this).replaceWith(iframe);
});
});
};

function oh_getImage(youtubeID)
{
var imgsrc = '',
index, len,
imageTypes = ['hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'];
for (index = 0, len = imageTypes.length; index < len; ++index) {
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/'+ imageTypes[index] +'.jpg';

if (imgsrc.width !=0){
break;
}
}

// Still no image, show the default one
if (imgsrc.width ==0){
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/default.jpg';
}

return imgsrc;
};

function oh_getUrl(sParam)
{
var sPageURL = window.location.search.substring(1);

// SimpleSEF or pretty urls?
if (sPageURL.indexOf(sParam) > -1) {
return true;
}

var sURLVariables = sPageURL.split(';');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return true;
}
}

return false;
}

function oh_refresh()
{
setTimeout(function(){oh_main()},3E3);
}

$(function(){
oh_main();

if (oh_getUrl('post'))
$('input[name=preview]').on('click',function(){
oh_refresh();
});
});
Title: Re: Ohara YouTube Embed
Post by: lurkalot on April 05, 2015, 03:08:56 PM
Suki, sorry for not coming back to you on this sooner.  Like I mentioned earlier, I was going to rebuild the site, which I've now done, fresh files etc.  Still testing a few things out, but your mod worked fine as it was.  I tested it after installing each mod.

Today I noticed it's stopped working again.  ???

So thanks I'll give your edit a go and report back.

Title: Re: Ohara YouTube Embed
Post by: Obcy on April 05, 2015, 03:11:03 PM
420connect.info
If your problem is the same as mine.
Solution:
http://www.smf.pl/index.php/topic,12124.msg60188.html#msg60188

OharaYTEmbed.php
It should look something like this.
Code: [Select]
// Someone else might not like this!
if (empty($message) || !empty($context['ohara_disable']))
    return $message;
if (empty($context['current_topic']))
    return $message;
// The extremely long regex...

I am not the author
Title: Re: Ohara YouTube Embed
Post by: Suki on April 05, 2015, 03:22:42 PM
Suki, sorry for not coming back to you on this sooner.  Like I mentioned earlier, I was going to rebuild the site, which I've now done, fresh files etc.  Still testing a few things out, but your mod worked fine as it was.  I tested it after installing each mod.

Today I noticed it's stopped working again.  ???

So thanks I'll give your edit a go and report back.



No worries, I was going to do a release but will wait until you are able to test this to see if that really fixed that issue or theres something else that needs to be fixed.

420connect.info
If your problem is the same as mine.
Solution:
http://www.smf.pl/index.php/topic,12124.msg60188.html#msg60188

OharaYTEmbed.php
It should look something like this.
Code: [Select]
// Someone else might not like this!
if (empty($message) || !empty($context['ohara_disable']))
    return $message;
if (empty($context['current_topic']))
    return $message;
// The extremely long regex...

I am not the author

I saw that fix but it doesn't really fix the issue, it just masquerades it, what you are doing is limiting the autoembed to the scope of $context['current_topic'] which is very limited.

There are other places where parse_bbc has legitimate uses, many mod authors do use it outside the scope of posting and topic display. You are basically cutting the whole tree just for a few rotten apples, thats not really a fix.
Title: Re: Ohara YouTube Embed
Post by: lurkalot on April 05, 2015, 03:28:34 PM

can you please test it to see if this also fixes your issue?


Ok done the edit but still no worky for me.  :'(

The thing I don't understand is why it's just suddenly stopped working again.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 05, 2015, 03:35:50 PM
OK, the produced div on the page you linked to still shows an ID without the oh_ prefix:

id="yIQGH4aQWI0"

Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:

$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';


Notice the   id="oh_'. $videoID .'"  part which have the oh_ prefix

Your file should look exactly like this one:  https://github.com/MissAllSunday/OharaYouTubeEmbed/blob/1.2/Sources/OharaYTEmbed.php
Title: Re: Ohara YouTube Embed
Post by: lurkalot on April 05, 2015, 04:26:23 PM
OK, the produced div on the page you linked to still shows an ID without the oh_ prefix:

id="yIQGH4aQWI0"

Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:

$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';


Notice the   id="oh_'. $videoID .'"  part which have the oh_ prefix

Your file should look exactly like this one:  https://github.com/MissAllSunday/OharaYouTubeEmbed/blob/1.2/Sources/OharaYTEmbed.php

Yep it was missing that part.  Actually, Just downloaded your mod again and checked it, and it's also missing from that file.

Edit:  Added the missing code and it's working again.  ;)
Title: Re: Ohara YouTube Embed
Post by: Suki on April 06, 2015, 11:14:37 AM
OK, the produced div on the page you linked to still shows an ID without the oh_ prefix:

id="yIQGH4aQWI0"

Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:

$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';


Notice the   id="oh_'. $videoID .'"  part which have the oh_ prefix

Your file should look exactly like this one:  https://github.com/MissAllSunday/OharaYouTubeEmbed/blob/1.2/Sources/OharaYTEmbed.php

Yep it was missing that part.  Actually, Just downloaded your mod again and checked it, and it's also missing from that file.

Edit:  Added the missing code and it's working again.  ;)

Thats because the current download doesn't have that code or any of the js code either, you are basically testing the new version which will have that code by default.
Title: Re: Ohara YouTube Embed
Post by: lurkalot on April 06, 2015, 04:41:46 PM

Thats because the current download doesn't have that code or any of the js code either, you are basically testing the new version which will have that code by default.

Yes I did think that might be the case, after I posted.  lol.  But what I can say for sure is it's working nicely now, Thank you.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 07, 2015, 02:43:44 PM
Cool, will release a new version shortly.
Title: Re: Ohara YouTube Embed
Post by: SDMiller on April 12, 2015, 12:14:52 AM
Hi. I have had ohara youtube embed mod for quite some time... and use it rarely... and it used to work.

Just noticed it quit working... so I updated it (mine was out of date apparently, in my package list it was a green dot indicating it was up to date.. which is why I didn't know it wasn't.).

I updated by first uninstalling and deleting the old one... then reinstalling and activating the new version.

Still doesn't work. I just get a black box where a youtube video should be in a post.

Any help?


smf 2.0.9
Title: Re: Ohara YouTube Embed
Post by: Suki on April 12, 2015, 10:08:40 AM
Do you have a link where I can see an example?  did you tried doing the edits I mentioned before?
Title: Re: Ohara YouTube Embed
Post by: SDMiller on April 12, 2015, 06:08:41 PM
Do you have a link where I can see an example?  did you tried doing the edits I mentioned before?

It's data looks like this:
Code: [Select]
[youtube]http://youtu.be/BOGOMIzl7Nk[/youtube]

Tight!

[url=https://youtu.be/BOGOMIzl7Nk]Link[/url], in case that video doesn't play.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 12, 2015, 08:16:06 PM
I really need a link to a post with a youtube video.
Title: Re: Ohara YouTube Embed
Post by: SDMiller on April 14, 2015, 09:21:18 PM
I really need a link to a post with a youtube video.

Oops. My bad. I meant to include that.

Here it is: http://mahjong.us.com/forum/index.php?topic=342.msg477;topicseen#new
Title: Re: Ohara YouTube Embed
Post by: Suki on April 15, 2015, 12:47:11 PM
Try the solution IU gave a couple of messages ago.
Title: Re: Ohara YouTube Embed
Post by: wahlmat on April 16, 2015, 08:26:45 PM
Hi! I just set up my SMF forum and one of the first things I tried to do was add a youtube button. It got successfully added, however I have one problem I'm experiencing. When I post a video, there is no "play-button" on the video, or any other controllers. Just a thumbnail, you can click on the thumbnail to start the video however. This is what mine looks like:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.gyazo.com%2F2eea95bd5ccc55f5894750113124b56f.png&hash=6f079bb389b427c80368313d43d62f27)

This is something like what I expected it to look like:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.gyazo.com%2F3cfc925e9357c90835bee523d2a6f06a.png&hash=317c1462463fc8d3b71f103235a61fae)

I really apologize if this issue has been answered earlier in the thread and I didn't see it!
Title: Re: Ohara YouTube Embed
Post by: Suki on April 17, 2015, 08:52:41 AM
A link where I can see this?

Most likely you do not have the oharaEmbed.css css file in whatever theme you are using, that file needs to be located at:

/Themes/your_theme/css/oharaEmbed.css

where your_theme is the actual name of the theme you are using.
Title: Re: Ohara YouTube Embed
Post by: wahlmat on April 17, 2015, 10:33:19 AM
A link where I can see this?

Most likely you do not have the oharaEmbed.css css file in whatever theme you are using, that file needs to be located at:

/Themes/your_theme/css/oharaEmbed.css

where your_theme is the actual name of the theme you are using.
Link to my forum is here: http://forum.energydrinkdiscussions.com/index.php?topic=6.0 (http://forum.energydrinkdiscussions.com/index.php?topic=6.0)
I've now at least managed to get a "play" button to show up, however not the usual one. I did extract the file you specified above to my current theme (the core one?). I did also extract the other file from scripts/languages that weren't imported.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 17, 2015, 10:35:38 AM
Quote
The topic or board you are looking for appears to be either missing or off limits to you.
Please login below or register an account with Energy Drink Discussions.
Title: Re: Ohara YouTube Embed
Post by: wahlmat on April 17, 2015, 11:29:04 AM
That's me being stupid.
http://forum.energydrinkdiscussions.com/index.php?topic=9.0 (http://forum.energydrinkdiscussions.com/index.php?topic=9.0)
First post in that topic!
Title: Re: Ohara YouTube Embed
Post by: Suki on April 17, 2015, 12:11:43 PM
It works just fine for me.
Title: Re: Ohara YouTube Embed
Post by: wahlmat on April 17, 2015, 12:27:21 PM
It works for me, to play the video, but when you go into a site, the "player" looks like this:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.gyazo.com%2F15cbb4ab14c31b70d5cf0a1d372027f2.png&hash=54fac9f4aaeceeb60e66cff502a95769)

Isn't it supposed to look something like this, the player?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.gyazo.com%2F3cfc925e9357c90835bee523d2a6f06a.png&hash=317c1462463fc8d3b71f103235a61fae)
Title: Re: Ohara YouTube Embed
Post by: Suki on April 17, 2015, 12:33:14 PM
No, the new version loads the video data on demand, ei, when the user clicks on the thumbnail. This is to render your pages faster.

Every video loads lots of stuff, the more videos you have on a page the more slow your page will be, this new version cuts that off by loading the video's data only when requested.
Title: Re: Ohara YouTube Embed
Post by: wahlmat on April 17, 2015, 12:42:48 PM
Ah okay, then that makes sense why it looks like that! Thanks!

Is it possible to revert to the older version that loads everything, even if that takes more data power to load?
Title: Re: Ohara YouTube Embed
Post by: Suki on April 17, 2015, 12:57:27 PM
Uninstall the current mod and install this https://github.com/MissAllSunday/OharaYouTubeEmbed/releases/tag/v1.2

OharaYTEmbed_v1.2.zip is a ready to install package


Be absolutely sure to install the mod on the theme you are currently using
Title: Re: Ohara YouTube Embed
Post by: wahlmat on April 17, 2015, 02:30:13 PM
Thanks! I will try it!
Title: Re: Ohara YouTube Embed
Post by: Low on April 27, 2015, 07:07:38 AM
Installed and now I have 500 error? I really should start reading problems with mods before installing third party as very few seem to work.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 27, 2015, 08:36:55 AM
500 errors are typically server issues which also explain why you seem to have issues with every mod you install.

Anyway, need more info, does your server log has anything?
Title: Re: Ohara YouTube Embed
Post by: Low on April 27, 2015, 11:11:58 AM
A lot of people seem to have server issues who install this mod. Permissions are set to 0755 fold  and 0644 files.
Title: Re: Ohara YouTube Embed
Post by: Suki on April 27, 2015, 11:21:06 AM
A lot of people seem to have server issues who install this mod. Permissions are set to 0755 fold  and 0644 files.

Can you please show me some examples of that?

I didn't ask what your permissions were, I ask whats in your php error log. Can you please provide what I asked, thanks.
Title: Re: Ohara YouTube Embed
Post by: Low on April 27, 2015, 11:33:58 AM
I don't have time to quote all of the people in this thread who also have the same 500 error. I mentioned the permissions because that seems to be the solution to all the other problems people have with this mod. Just thought I'd save time.
Title: Re: Ohara YouTube Embed
Post by: Low on April 27, 2015, 11:35:18 AM
No errors are showing in logs
Title: Re: Ohara YouTube Embed
Post by: Suki on April 27, 2015, 11:43:57 AM
I don't have time to quote all of the people in this thread who also have the same 500 error. I mentioned the permissions because that seems to be the solution to all the other problems people have with this mod. Just thought I'd save time.

You certainly did have time to check it so please provide actual facts to back up your statement.


Anyway, this is a search for "500" on this topic:  http://www.simplemachines.org/community/index.php?action=search2;search=500;topic=462968

It shows a grand total of 3 people having "error 500" issues (you included).   3 people out of more than 10k downloads this mod has certainly isn't "a lot".

Just want to make this clear enough, claiming false accusations  will not get you anywhere if you want to receive support from me.

Now, as the search results indicates, 500 errors are usually due to bad/weird server configurations, specially host that naively restrict 0777 permissions or otherwise flag them as insecure.  There is nothing I can do a bout it since it is not within this mod's range to actually fix that (2.1 already addressed this, I haven't check it that deeply).

Your best bet would be to manually install this mod(following the mod's parser) , which is quite easy or use another mod but you will face the same issues you already have with this one anyway ::), which once again proves that it is your server the culprit rather than this mod.
Title: Re: Ohara YouTube Embed
Post by: Low on April 27, 2015, 06:27:39 PM
False accusations? You ASSUME it's everyone else fault but my domain with a fresh copy of SMF 2.0.9 was fine until the second YOUR mod was uploaded. It's caused a lot of problems for many others as well as you pointed out. Not everyone who uses SMF is a developer and perhaps a warning should be placed with your mod what can happen with certain hosts (assuming it is our hosts fault, I still don't know).
Title: Re: Ohara YouTube Embed
Post by: Suki on April 27, 2015, 06:53:13 PM
Yes, false accusations, when you are asked to back up your statements but failed to do so. Pretty basic concept.

I already pointed out that only 3 out of 10k downloads has ever have a 500 issue with this mod and in all those 3 cases (including you) it was their server configuration.

I also already pointed out that you will have the same issue no matter what mod you decide to install but please be my guest and do try to check that for yourself :)

I honestly do not have the time to argue with you, I already give you an answer, take it or leave it, you are also free to install any other mod you see fit, you aren't required to install any of the modifications I made and/or maintain.

Looking at your other support requests it seems you are quite a "difficult customer" and seems to love to have arguments just for the sake of having an argument so pardon me if I, from now on, pass from any support request from you.

My only concern is to clear any false accusations, which I already did, no point in keep on being reiterative.
Title: Re: Ohara YouTube Embed
Post by: Low on April 27, 2015, 07:31:32 PM
They are not false accusations. Your mod does not work with some server configurations and a lot of people have had the same 500 problem which happened directly after installing your mod. I've seen your replies to other people who have had problems with your mod and I think I'll stay away from any mod you produce in the future. All the best.
Title: Re: Ohara YouTube Embed
Post by: Myth_72 on May 07, 2015, 04:59:16 AM
I installed it, but it show me, black square but not youtube clips
Title: Re: Ohara YouTube Embed
Post by: Suki on May 07, 2015, 08:33:22 AM

I see where the error is, the .css file only gets uploaded to the default theme but the code is using $settings['theme_url'] which will try to use the current installed theme and not the default one :(

I'll release a fix for this later.  In the meantime you can try this:

Open your Sources/OharaYTEmbed.php and find this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['theme_url'] .'/css/oharaEmbed.css" />
And replace it with this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />
Title: Re: Ohara YouTube Embed
Post by: rtil on May 08, 2015, 10:19:33 PM
when i install this the configuration area appears blank in the admin panel, and youtube links simply just have the [youtube] bbcode around them but don't show up as embedded videos.

one thing to mention is that i have aeva 7.1 which recently stopped working on youtube videos because google deprecated their old API that it used . so i disabled the youtube options in aeva. even though they are disabled could it possibly be conflicting with this mod? i'm on 2.0.7 and php 5.4
Title: Re: Ohara YouTube Embed
Post by: SDMiller on May 09, 2015, 12:51:20 AM
Try the solution IU gave a couple of messages ago.

Hi Suki,

I tried the solution you gave, specifically:
Replace the entire  Themes/default/scripts/ohyoutube.js with this:

and also I did this:

Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:

... and I still get the same black box which doesn't play on posts using the ohara button, as seen in this (http://mahjong.us.com/forum/index.php?topic=350.msg489#msg489) example.

Note: the top video box is embedded by admin allowing for html and then using the youtube's embed iframe.
         the bottom black non-working video box is embedded using the ohara button. It's there so you can see it.

In case you're curious, it doesn't matter if ohara is used alone, or following html code, iframe, and cutoff. Its there now at the bottom of that post so that you can take a look at how your code is working (or not working).

The raw code for that post is as follows:

Code: [Select]
[html]
<p> <iframe width="560" height="315" src="https://www.youtube.com/embed/lbG4ryrsb6w?showinfo=0" frameborder="0" allowfullscreen></iframe> </p>
<p>HUNG HOM, Hong Kong - Hiding under the stairs in the shopping district, in a venue actually called Under the Staircase Shop, works Sister May, who carries on her family's tradition of hand making mahjong tiles in her nestled workshop Kam Fat Mahjong at 2 Bulkeley Street.</p>
<!-- <p><a href="http://www.womenofchina.cn/womenofchina/html1/news/newsmakers/1504/1476-1.htm"><em><img style="float: left;" src="images/stories/various/readmore.png" alt="readmore" /></em></a></p>
<p> </p> -->



[/html][cutoff]

[youtube]https://youtu.be/lbG4ryrsb6w[/youtube]


Any help?

Thanks a bunch. This mod used to work for me, not sure what smf/ohara update broke it.

Thanks again.

^_^
Title: Re: Ohara YouTube Embed
Post by: Suki on May 09, 2015, 01:59:46 PM
@SDMiller  Do you have a link where I can see this behavior?


@rtil What  do you mean by blank page?  does it happens on install or any time you access your admin pages?  what php version are you using?
Title: Re: Ohara YouTube Embed
Post by: SDMiller on May 10, 2015, 03:02:57 PM
@SDMiller  Do you have a link where I can see this behavior?

... and I still get the same black box which doesn't play on posts using the ohara button, as seen in this (http://mahjong.us.com/forum/index.php?topic=350.msg489#msg489) example.

Any help?

Thanks a bunch. This mod used to work for me, not sure what smf/ohara update broke it.

Thanks again.

^_^
Title: Re: Ohara YouTube Embed
Post by: FLEXjs on May 10, 2015, 05:24:08 PM
I tried to install this mod and broke my forum.

This is the error I get when I try to access it:

Parse error: syntax error, unexpected T_FUNCTION in /home/content/53/9126953/html/forums/Sources/OharaYTEmbed.php on line 28

I uploaded the "removeHooks" file but when I try to access it I get the same error.

How can I fix it please?
Title: Re: Ohara YouTube Embed
Post by: margarett on May 10, 2015, 05:46:18 PM
Your PHP version is probably too low to run this MOD.
The best way is to remove the file. Not being there, the hook will fail to load but your forum should load, thus allowing you to finish the removal ;)
Title: Re: Ohara YouTube Embed
Post by: FLEXjs on May 10, 2015, 05:53:11 PM
OK, I downloaded the "repair_settings.php" and was able to use it to remove all hooks, revert everyone to the default SMF theme, log in, and change it back and uninstall the mod.

Everything seems to be OK now except when I click on the "Admin" button I get this error:

Fatal error: Call to undefined function OYTE_Who() in /home/content/53/9126953/html/forums/Sources/Who.php on line 766
Title: Re: Ohara YouTube Embed
Post by: margarett on May 10, 2015, 06:12:14 PM
Edit your Who.php and remove the function call to OYTE_Who ;)

Or attach the file ;)
Title: Re: Ohara YouTube Embed
Post by: Suki on May 10, 2015, 10:22:33 PM
@SDMiller  Try the solution listed here:


I see where the error is, the .css file only gets uploaded to the default theme but the code is using $settings['theme_url'] which will try to use the current installed theme and not the default one :(

I'll release a fix for this later.  In the meantime you can try this:

Open your Sources/OharaYTEmbed.php and find this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['theme_url'] .'/css/oharaEmbed.css" />
And replace it with this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />

Its a bug in the mod but I haven't have time to release a new version with the fix.


@FLEXjs  Funny, that function OYTE_Who() is form an old Ohara version, the current version doesn't use that function anymore. That indicates that you might have multiple installs of different versions of this mod.
Title: Re: Ohara YouTube Embed
Post by: SDMiller on May 11, 2015, 01:47:53 AM
@SDMiller  Try the solution listed here:

Open your Sources/OharaYTEmbed.php and find this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['theme_url'] .'/css/oharaEmbed.css" />
And replace it with this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />


I did that... still doesn't work.

Don't forget I previously did this:

Replace the entire  Themes/default/scripts/ohyoutube.js with this:

and I also previously did this:

Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:

Was I supposed to do the new fix on top of the other two, so ALL THREE manual fixes, or just this latest one all by itself:
Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />[/quote]

Thanks for trying to get it working with me.

=)
Title: Re: Ohara YouTube Embed
Post by: Suki on May 11, 2015, 10:06:48 AM
Yes, do all those steps.

Now it looks like some other mod added jquery and its using its "no conflict" features which means that the var this mod uses to reference jquery no longer works: $

Can you do another manual fix? besides all the other fixes, open your Themes/default/scripts/ohyoutube.js

find all instances of this: 

$(

and change it for this:

jQuery(

You can do it pretty easily with a code editor like notepad++ actually it will be better to do it with a code editor since doing it manually may result in some instances missed and a single $( missed will prevent the script from working.


Also, the "glossary" mod is using a very outdated version of jquery, that may also be part of the issue.  Might be useful if that mod uses a more recent version.
Title: Re: Ohara YouTube Embed
Post by: FLEXjs on May 11, 2015, 11:16:33 AM

@FLEXjs  Funny, that function OYTE_Who() is form an old Ohara version, the current version doesn't use that function anymore. That indicates that you might have multiple installs of different versions of this mod.

I did have 2 versions installed.  I uninstalled them both and deleted them both but I am still getting that error.

Any idea how to fix?

Thanks.
Title: Re: Ohara YouTube Embed
Post by: margarett on May 11, 2015, 11:41:21 AM
Ouch, you should never have 2 versions installed :o

Your best possibility is to check each version's manual installation instructions backwards and make sure that everything is removed...
Manual Installation of Mods (http://wiki.simplemachines.org/smf/Manual_installation_of_mods)
Title: Re: Ohara YouTube Embed
Post by: SDMiller on May 16, 2015, 12:01:56 PM
find all instances of this: 

$(

and change it for this:

jQuery(

I did that. Still no worky. :(

Code: [Select]
/*
╩Copyright (c) 2015 Jessica Gonzçlez
╩@license http://www.mozilla.org/MPL/MPL-1.1.html
*/

function oh_main(){

jQuery('.youtube').each(function() {

var videoID = this.id.replace('oh_',''),
imgsrc = oh_getImage(videoID),
imgHeight = jQuery(this).height(),
imgWidth = jQuery(this).width();

if (typeof imgsrc !== 'undefined'){
jQuery(this).css({'background-image': 'url('+ imgsrc +')', 'background-size': 'cover'});
}

jQuery(this).append(jQuery('<div/>', {'class': 'youtube_play'}));

jQuery('#oh_'+videoID).on('click', function() {
var iframe_url = 'https://www.youtube.com/embed/' + videoID + '?autoplay=1&autohide=1';
if (jQuery(this).data('params')) iframe_url+='&'+jQuery(this).data('params');

// The height and width of the iFrame should be the same as parent
var iframe = jQuery('<iframe/>', {'frameborder': '0', 'src': iframe_url, 'width': imgWidth, 'height': imgHeight })

// Replace the YouTube thumbnail with YouTube HTML5 Player
jQuery(this).replaceWith(iframe);
});
});
};

function oh_getImage(youtubeID)
{
var imgsrc = '',
index, len,
imageTypes = ['hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'];
for (index = 0, len = imageTypes.length; index < len; ++index) {
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/'+ imageTypes[index] +'.jpg';

if (imgsrc.width !=0){
break;
}
}

// Still no image, show the default one
if (imgsrc.width ==0){
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/default.jpg';
}

return imgsrc;
};

function oh_getUrl(sParam)
{
var sPageURL = window.location.search.substring(1);

// SimpleSEF or pretty urls?
if (sPageURL.indexOf(sParam) > -1) {
return true;
}

var sURLVariables = sPageURL.split(';');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return true;
}
}

return false;
}

function oh_refresh()
{
setTimeout(function(){oh_main()},3E3);
}

jQuery(function(){
oh_main();

if (oh_getUrl('post'))
jQuery('input[name=preview]').on('click',function(){
oh_refresh();
});
});
Title: Re: Ohara YouTube Embed
Post by: FLEXjs on May 16, 2015, 01:32:34 PM
@FLEXjs  Funny, that function OYTE_Who() is form an old Ohara version, the current version doesn't use that function anymore. That indicates that you might have multiple installs of different versions of this mod.

So how can I fix because in the package manager it doesn't show any versions as being installed anymore.

Here is the who.php file....
Title: Re: Ohara YouTube Embed
Post by: Suki on May 16, 2015, 01:36:07 PM
@SDMiller the glossary mod you have has a very outdated version of jquery that may prevent this mod form working properly.

@FLEXjs  heres the file without the call to that function.
Title: Re: Ohara YouTube Embed
Post by: FLEXjs on May 16, 2015, 01:46:19 PM
Thank you.  :)
Title: Re: Ohara YouTube Embed
Post by: SDMiller on May 17, 2015, 10:44:07 PM
@SDMiller the glossary mod you have has a very outdated version of jquery that may prevent this mod form working properly.

Yes, you were quite right. I uninstalled glossary mod (which had to be carefully done manually because it failed almost every test it ran before uninstalling) and now your embed button works as it should.

Which now raises the question.... should I undo this step of your fixes now?
Now it looks like some other mod added jquery and its using its "no conflict" features which means that the var this mod uses to reference jquery no longer works: $

Can you do another manual fix? besides all the other fixes, open your Themes/default/scripts/ohyoutube.js

find all instances of this: 

$(

and change it for this:

jQuery(

I wonder if that step is not only no longer necessary, but may interfere with future checks/find functions.

Thanks for all your support with your mod.

 :laugh:
Title: Re: Ohara YouTube Embed
Post by: Suki on May 18, 2015, 01:50:03 PM
Well, there was a chance that the glossary mod will have worked with an updated version of jquery, so there was no need to fully uninstall it, just remove the call to the outdated jquery version :P

As for undoing that las change, there is no harm if you leave it as it is or revert it back, that was just a safe call to prevent possible library conflicts.
Title: Re: Ohara YouTube Embed
Post by: FragaCampos on May 21, 2015, 05:59:34 PM
Hi there.
I've tested this mod in localhost and although vimeo videos appear correctly, youtube videos don't. The topic stays normal, but the video doesn't appear (with and without tags).
What may be wrong?

Regards.
Title: Re: Ohara YouTube Embed
Post by: Suki on June 16, 2015, 07:21:37 PM
Can you check this new release? https://github.com/MissAllSunday/OharaYouTubeEmbed/releases/tag/v1.2.2

It should solve all the recent issues, the first zip is a ready to load package.
Title: Re: Ohara YouTube Embed
Post by: Douglas on June 25, 2015, 12:24:47 PM
Suki, three questions... (and please understand that I haven't read all 9 pages, so please forgive me if this was answered already).

First, do you support (or plan on adding support for) extremely short tags? [youtube]{ID}[/youtube] (I'm using Karl's Youtube Mod on Hogville and need to replace it. Trying to not go the Aeva route.)

Second, does your mod intelligently handle SSL vs non SSL requests?

Youtube supports "//youtube.com/etc" (notice the absence of https: and http: there).

Third, do you have any plans on adding Vine support? I've manually added the Vine player/app onto Hogville (see this thread (http://www.hogville.net/yabbse/index.php?topic=549142.0)); can provide you with the needed info to embed Vine, as well, if you want (hit me up via PM).

Thanks!
Title: Re: Ohara YouTube Embed
Post by: Suki on June 25, 2015, 01:52:01 PM
First, do you support (or plan on adding support for) extremely short tags? [youtube]{ID}[/youtube] (I'm using Karl's Youtube Mod on Hogville and need to replace it. Trying to not go the Aeva route.)

It is planned yes.

Quote
Second, does your mod intelligently handle SSL vs non SSL requests?

Yes.

Quote
Third, do you have any plans on adding Vine support? I've manually added the Vine player/app onto Hogville (see this thread); can provide you with the needed info to embed Vine, as well, if you want (hit me up via PM).

The new version has a simple auto-load plugin which makes it quite easy to add support for other sites, just a matter of uploading a file to the plugin folder and the corresponding img too.  The problem is that this new version will only be compatible with SMF 2.1.
Title: Re: Ohara YouTube Embed
Post by: Suki on June 27, 2015, 10:18:42 AM
I uploaded a new version, should fix all the issues reported with the old version. Heres the changelog:

1.2.3 - June 26, 2015,
- Added a minified js file.
- Added support for using the youtube ID as param.
- License change to MPL 2.0.
- Added full support for protocol-less urls.
- Force loading the oharaEmbed.css file from the default theme.
- Add more options to show video preview images
- Add support for previewing a message
- Improve handling of youtube thumbnails and overall JS improvements.
- Add a setting to enable/disable the autoembed feature. This was suppose to be added a long time ago but dunno why I forgot to do it...
- Missed to check the master setting.
Title: Re: Ohara YouTube Embed
Post by: Douglas on June 27, 2015, 10:34:09 AM
Suki, if I could hug (high five?) ya, I would. Thank you!
Title: Re: Ohara YouTube Embed
Post by: yakyakyak on June 27, 2015, 10:52:03 AM
Just installed this on 2.0.9 and package manager showed no issues however, after install, the forum is running but the admin panel isn't

The requested URL /admin/index.php was not found on this server.

Any ideas?
Title: Re: Ohara YouTube Embed
Post by: Suki on June 27, 2015, 11:08:56 AM
Do you have a "pretty urls" mod installed?  admin/index.php is not a vanilla SMF url.

Is it only the admin panel?  for some reason this mod likes to annoy crappy hostings by setting files to 777 which some host may see as "too much" and inmediatly show a 500 error. Reverting the permissions to the file solves the issue.
Title: Re: Ohara YouTube Embed
Post by: yakyakyak on June 27, 2015, 02:01:03 PM
Do you have a "pretty urls" mod installed?  admin/index.php is not a vanilla SMF url.

Is it only the admin panel?  for some reason this mod likes to annoy crappy hostings by setting files to 777 which some host may see as "too much" and inmediatly show a 500 error. Reverting the permissions to the file solves the issue.

ha ha, spot on with Pretty. It was just the admin panel and you were correct with the permissions. Thanks for the prompt reply.
Title: Re: Ohara YouTube Embed
Post by: yakyakyak on June 28, 2015, 07:21:02 AM
Vimeo working, Youtube not, on the same topic or individual topics. Presented with a black box for YouTube

Anything glaringly obvious you can think of please?
Title: Re: Ohara YouTube Embed
Post by: Suki on June 28, 2015, 10:06:21 AM
This is the kind of bugs this new version was supposed to fix...

Can you post a link to a post with a youtube video?
Title: Re: Ohara YouTube Embed
Post by: yakyakyak on June 28, 2015, 10:49:43 AM
Yep. I've inboxed you Suki wit a login and url



Title: Re: Ohara YouTube Embed
Post by: Suki on June 28, 2015, 10:53:38 AM
You are using another mod which uses jquery with "jQuery" as the variable name, this mod (and SMF 2.1 too) uses "$".

You need to either change the other mod to use $ or replace all instance of $ with jQuery on the Themes/default/scripts/ohyoutube.min.js file file.
Title: Re: Ohara YouTube Embed
Post by: yakyakyak on June 28, 2015, 11:18:08 AM
You are using another mod which uses jquery with "jQuery" as the variable name, this mod (and SMF 2.1 too) uses "$".

You need to either change the other mod to use $ or replace all instance of $ with jQuery on the Themes/default/scripts/ohyoutube.min.js file file.

Thank you for the prompt reply Suki. I am partially sighted so will let you know how it goes when i can get a friend to make the edits.

Title: Re: Ohara YouTube Embed
Post by: Suki on June 28, 2015, 12:34:22 PM
Yes, this has happen before, unfortunately there isn't much I can do since each mod author uses different name conventions and even different jquery versions.

Hopefully SMF 2.1 will terminate this kind of behavior, at least for new mods released for that particular version since 2.1 now includes jquery by default and we can now have more control over which jquery version a mod uses and the variable name a mod should use too.
Title: Re: Ohara YouTube Embed
Post by: mrkid on June 28, 2015, 12:59:00 PM
Suki, I was using Aeva for all pics and videos. Youtube obviously stopped allowing this. I loaded your mod, and the links changed to black boxes. I even disable Aeva, and still only get boxes. If I drop the "s" from https, Aeva works fine, but don't feel like editing 1000's of old posts. Is Aeva causing a conflict?
Title: Re: Ohara YouTube Embed
Post by: yakyakyak on June 28, 2015, 01:27:11 PM
Suki, I was using Aeva for all pics and videos. Youtube obviously stopped allowing this. I loaded your mod, and the links changed to black boxes. I even disable Aeva, and still only get boxes. If I drop the "s" from https, Aeva works fine, but don't feel like editing 1000's of old posts. Is Aeva causing a conflict?

could you not use censor word to change just part of the url on https youtube links to cure your problem?

from https://youtube.com
to:
http://youtube.com
Title: Re: Ohara YouTube Embed
Post by: mrkid on June 28, 2015, 01:29:05 PM
Oh, good idea. Let me try that.

But any clue why the videos show as black boxes?
Title: Re: Ohara YouTube Embed
Post by: yakyakyak on June 28, 2015, 01:32:17 PM
I am in the same boat but am removing the mod in favour of another solution. But i think your issue just may be sorted  ;D

Good luck

Title: Re: Ohara YouTube Embed
Post by: mrkid on June 28, 2015, 01:39:23 PM
Yes, the censoring replace repaired all of the links, but I had to turn off this mod. It's a shame, because this mod would be much safer in the long run. I now can't post secure links.
Title: Re: Ohara YouTube Embed
Post by: Suki on June 28, 2015, 01:48:20 PM
Suki, I was using Aeva for all pics and videos. Youtube obviously stopped allowing this. I loaded your mod, and the links changed to black boxes. I even disable Aeva, and still only get boxes. If I drop the "s" from https, Aeva works fine, but don't feel like editing 1000's of old posts. Is Aeva causing a conflict?

Can I have a link to a post showing the problem?

This mod and aeva will not play nice if you allow both mods to parse youtube videos, I believe aeva allows you to disable the autoembed feature while keeping it as a gallery only.
Title: Re: Ohara YouTube Embed
Post by: mrkid on June 30, 2015, 07:19:30 PM
I have it working with Aeva by censoring https http as you recommended. If I disabled Aeva with the master disable, the videos would show as black boxes. They were not clickable, even though it gave you a cursor. I imagine if I got rid of aeva altogether, the code would not conflict, but I have a ton of Youtube videos.
Title: Re: Ohara YouTube Embed
Post by: Suki on July 01, 2015, 09:32:14 AM
Well, nope, I didn't recommend censoring anything :P

The page you showed me its showing videos just fine using aeva, meaning you're not really using this mod, actually it seems you are no longer using this mod.
Title: Re: Ohara YouTube Embed
Post by: mrkid on July 01, 2015, 06:25:24 PM
Well, nope, I didn't recommend censoring anything :P

The page you showed me its showing videos just fine using aeva, meaning you're not really using this mod, actually it seems you are no longer using this mod.

Sorry, YakYakYak gave me that tip.

No, I am not using the mod. I had to remove it because even with Aeva disabled, the videos showed as black blocks.
Title: Re: Ohara YouTube Embed
Post by: hcfwesker on July 02, 2015, 11:44:48 PM
Open your /Sources/OharaYTEmbed.php file and find 2 instances of this:

Code: [Select]
src="http://www.youtube.com/embed/$1"

Change both of them to this:

Code: [Select]
src="http://www.youtube.com/embed/$1&vq=hd720"

Was looking for this.  I tried both the edits in the same file, and now videos don't appear at all, so reverted back.  Anything else need to be done to get auto 720p settings? 

EDIT:  Welp, Realized the only way to get the auto 720p to work, was to set the actual embedded video size to 1280x720, kinda defeats the purpose since we can't have over sized videos posted :(  Least the option is there though.


Title: Re: Ohara YouTube Embed
Post by: FragaCampos on July 04, 2015, 08:56:14 PM
Thanks a lot for this tweak, Suki.
Although I would like to know what mod is using jquery instead of $ and causing this, it solved the black screen problem.

Kudos for your effort with this indispensable mod.

You are using another mod which uses jquery with "jQuery" as the variable name, this mod (and SMF 2.1 too) uses "$".

You need to either change the other mod to use $ or replace all instance of $ with jQuery on the Themes/default/scripts/ohyoutube.min.js file file.
Title: Re: Ohara YouTube Embed
Post by: Suki on July 05, 2015, 01:14:34 PM
Since this mod (the youtube tag) now solely relies on jQuery I really need to find a way to avoid other mods interfering with it.  Its really a shame, I shouldn't have to worry about other mod's mess...

Hopefully SMF 2.1 solves this issue but then again many many mods will not be "properly" updated to 2.1 so I'm afraid this problem will still exists.
Title: Re: Ohara YouTube Embed
Post by: mrkid on July 05, 2015, 03:51:09 PM
Suki, I applied the "jquery" change, got rid of the https>http censor, and have both Aeva and your mod running. Everything is functioning perfectly. Thanks for the great mod!
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on July 11, 2015, 11:30:06 AM
Can anyone confirm if the latest version of this mod makes video sizes responsive? (or know if this would be difficult to implement?)
Title: Re: Ohara YouTube Embed
Post by: FragaCampos on July 23, 2015, 06:52:26 AM
I know this already came up in this topic, but I guess it was not addressed again.
Is it possible or not very difficult to implement list support for youtube videos?
Title: Re: Ohara YouTube Embed
Post by: mrkid on July 23, 2015, 07:41:47 PM
The mod was working fine with Youtube, but seems to have stopped in the past few days. Not sure if Youtube changed their coding again.
Title: Re: Ohara YouTube Embed
Post by: FragaCampos on July 24, 2015, 11:44:40 AM
Its working fine over here.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on July 28, 2015, 08:54:43 AM
Actually, having this creates a lot of issues, specially when viewing a topic on a really large screen.  This bit of css matches the whole size of the screen, meaning that you will end up with a video as large as the actual screen, that looks pretty weird on desktops...  I know it shouldn't be an issue on smaller screens but for desktop ones it really feels rather weird having a huge video screen.

Using css @media will sove this but then again I no longer trust $context['html_headers'] since mod authors use it wrongly so this will be implemented only on the version compatible with SMF 2.1.  Will post simple instructions for people who still want to have this.

Still looking to make the videos responsive..  :-*
Title: Re: Ohara YouTube Embed
Post by: Suki on July 28, 2015, 11:47:23 AM
And I'm already working on it... (https://github.com/MissAllSunday/OharaYouTubeEmbed/commit/33ddac8344aca416be1974a4bf1da0e8778a8f74) but time is limited and have other priorities right now. 

Youtube lists will not be supported as they require using the youtube API which means having to constantly made changes to keep up with it, I don't have the resources nor the motivation to do that.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on July 28, 2015, 01:15:23 PM
My apologies Suki,

I thought there was already a way to make them responsive using CSS at the moment..

(..although my attempts seem made the videos invisible?!)

I've undone all my edits for now and I'll just hang on for your instructions*!  O:)



Using css @media will sove this but then again I no longer trust $context['html_headers'] since mod authors use it wrongly so this will be implemented only on the version compatible with SMF 2.1.  Will post simple instructions for people who still want to have this.

*Just to clarify on this part..
You will post instructions for people using the 2.0.1 to make the videos responsive but won't be adding it into the actual release?
but the version for 2.1 will have it built in, in an alternate method?

.. Right?  ???



& Many thanks for the time you have put into it already! :)

Title: Re: Ohara YouTube Embed
Post by: Suki on July 28, 2015, 04:00:31 PM
I have since then changed the approach, I am now using js to render videos (and make them responsive) and use the same approach for this mod's 2.0 and 2.1 versions which means any change I added will be ported to both 2.0 and 2.1.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on July 28, 2015, 04:29:40 PM
Ahh okay!

Thanks for clearing that one up & I look forward to the next release.  :)
Title: Re: Ohara YouTube Embed
Post by: Suki on August 02, 2015, 02:08:02 PM
@420connect.info  can you please test this new version? it does include support for responsive videos and a few other fixes Do note that this will only work if you have a responsive theme, the default curve theme or any other variant of it will not work.

I tested this with the Responsive Curve mod and works well with it.

Heres the changelog:

1.2.4 - August 2, 2015,
- Added responsiveness to videos. This will only work on responsive themes.
- Fixed an issue when two or more instances of the same video where posted, none of them would be played.
- Re-wrote the JS code to use prototypes.
- Change the default size values to 480 x 270.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on August 02, 2015, 02:21:15 PM
@420connect.info  can you please test this new version? it does include support for responsive videos and a few other fixes Do note that this will only work if you have a responsive theme, the default curve theme or any other variant of it will not work.

I tested this with the Responsive Curve mod and works well with it.

Heres the changelog:

1.2.4 - August 2, 2015,
- Added responsiveness to videos. This will only work on responsive themes.
- Fixed an issue when two or more instances of the same video where posted, none of them would be played.
- Re-wrote the JS code to use prototypes.
- Change the default size values to 480 x 270.

Ahhhhhhhhh!

 :-*  :-*  :-*

I can confirm this version works with Redsy (http://www.simplemachines.org/community/index.php?topic=535335.msg3803569#msg3803569)!

Many thanks Suki!
Great job as always!  ;D

(I'm also just about to PM you with something you may be interested in!)
Title: Re: Ohara YouTube Embed
Post by: kitz on August 02, 2015, 03:12:20 PM
Thank you so very much for this mod.

I'd just spent quite some time trying to find out why my forum had suddenly started throwing 1000's of errors after a php upgrade.   The cause was YouTube BBCode which I'd previously used for many years without any problem.    I'd been looking for a suitable replacement which would not only handle the full url, but also take the param id so that all previous links would work.  Your update last month did just this.

The hard part was finding out what was wrong and trying to find a suitable replacement.   
The easy part was uninstalling YouTube BBCode and installing Ohara YouTube Embed.

Thanks - it works beautifully.  :)


Title: Re: Ohara YouTube Embed
Post by: DSystem on August 02, 2015, 04:39:33 PM
Simply perfect (1.2.4 - August 2, 2015)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feletronicabr.com%2FSmileys%2Fblue%2Fkiss.gif&hash=1428365606f3e4f12c532eef38060a48)


Anyone who wants to see this new version up and running. Just check out this link:
http://eletronicabr.com/eletrotreco/19/conheca-o-sky-tower-o-novo-brinquedo-de-um-parque-dinamarques/35592/
Title: Re: Ohara YouTube Embed
Post by: Suki on August 05, 2015, 10:37:22 AM
Cool, I went ahead and updated the mod.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on August 07, 2015, 12:02:07 PM
Tiny bug report for the last version.

Code: [Select]
<script type="text/javascript">!window.jQuery && document.write(unescape(\'%3Cscript src="//code.jquery.com/jquery-1.9.1.min.js"%3E%3C/script%3E\'))</script> in OharaYTEmbed.php fails while validating the XHTML ;)

Quote
character "&" is the first character of a delimiter but occurred as data

Regards
Title: Re: Ohara YouTube Embed
Post by: Suki on August 07, 2015, 12:12:57 PM
Already aware of it since the first time I used, not really a bug, its just the validator not knowing how to handle JavaScript code or rather interpreting it wrong.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on August 07, 2015, 12:27:53 PM
I know that the validator sucks, but isn't there a workaround for it?
Title: Re: Ohara YouTube Embed
Post by: Suki on August 07, 2015, 12:42:30 PM
You can't fix something that isn't broken nor there isn't a workaround for something thats working as expected. You can remove that line of course, thats up to you. That line is there to prevent re-loading jquery if it has been loaded by another mod or loading it if it hasn't.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on August 07, 2015, 01:43:49 PM
Well, I have tried this:
Code: [Select]
<script type="text/javascript">
//<![CDATA[
!window.jQuery && document.write(unescape(\'%3Cscript src="//code.jquery.com/jquery-1.9.1.min.js"%3E%3C/script%3E\'))
//]]>
</script>
And the file gets called correctly, not sure if from the same mod, but since it's 1.9.1 version I think it is this mod, as I don't recall of any other mod I have using 1.9.1 (I could be very wrong at this, I am running 140 mods, please bear with me :D). Gonna have a second look later on.
Title: Re: Ohara YouTube Embed
Post by: FinalBoss on August 08, 2015, 11:50:35 PM
Hello - great mod I have been using it non stop on my own forum.

However there is an issue with the actual image that represents the youtube and vmeo button on the post page. Where it would usually have the image for youtube (near the smilies) there is a button but it has no picture for it. Just a broken image link there. The button still works but for members who dont know the system it is difficult for them to realise what the button is for (because it had no image)

Is there a fix for this?

Thank you for the great mod
Title: Re: Ohara YouTube Embed
Post by: kitz on August 09, 2015, 06:29:45 AM
Works fine here.
Make sure that you have a vimeo image in each of the themes that are in use on your forum.   For eg the path would be something like

yourForum/Themes/yourTheme/images/bbc/youtube.gif
yourForum/Themes/yourTheme/images/bbc/vimeo.gif

Ive attached a copy of youtube.gif & vimeo.gif just in case you dont already have them.
Title: Re: Ohara YouTube Embed
Post by: FinalBoss on August 10, 2015, 02:34:11 AM
Kitz = legend!!! Fixed it, worked a treat - not sure why it didnt install the pictures to start with though. Any way, thanks for your time.
Title: Re: Ohara YouTube Embed
Post by: Liquidus on August 13, 2015, 07:33:26 AM
I'm getting a black screen, Anyone knows what the problem is?

I tried with this link [youtube]http://www.youtube.com/watch?v=9w9dXWU5nMI[/youtube]


Edit: Vimeo works fine, only with youtube im getting the problem.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 14, 2015, 12:52:46 PM
You have another mod installed with an old jquery version or another JS framework library. Need a link to your site to debug further.
Title: Re: Ohara YouTube Embed
Post by: Liquidus on August 16, 2015, 04:58:40 PM
hxxp://www.underground-of-hd.com/forum/index.php
Title: Re: Ohara YouTube Embed
Post by: Suki on August 16, 2015, 05:45:14 PM
Your forum  isn't open to guest.  Anyway, try this: http://www.simplemachines.org/community/index.php?topic=462968.msg3821245#msg3821245
Title: Re: Ohara YouTube Embed
Post by: Rudy23 on October 01, 2015, 08:52:28 AM
Is it just me or it doesn't work with the newest SMF 2.0.11 version?
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on October 01, 2015, 03:59:34 PM
Just you...
Title: Re: Ohara YouTube Embed
Post by: Rudy23 on October 02, 2015, 03:13:30 PM
Installed an older version and it works.
Title: Re: Ohara YouTube Embed
Post by: margarett on October 28, 2015, 08:13:43 PM
Suki, is adding the video title to the image preview on your plans? ;)
Title: Re: Ohara YouTube Embed
Post by: Suki on October 29, 2015, 12:48:28 PM
Only if I can find a reliable way to get that info without using their API. Theres the get_video call but I'm not sure if they are going to keep supporting it.
Title: Re: Ohara YouTube Embed
Post by: margarett on October 29, 2015, 08:13:49 PM
Fair enough ;)
Title: Re: Ohara YouTube Embed
Post by: Suki on November 13, 2015, 04:07:45 PM
For those of you interested, I've been updating this mod to work and use some of the new features SMF 2.1 offers, so far this is the result. Attached is a beta of this mod for SMF 2.1, the new features include:

- No file edits. Works with every present or future theme you may install.
- Works with the WYSIWYG editor. You can toggle between the normal and the html view.
- No "add iframe" to the list of allowed tags.
- Faster page loads. The mod only loads a video if the user clicks on it
- The mod now displays the video title and an image preview. The title is fully customizable via css.
- It is now easier to add new sites, will eventually release separate packages to add more videos without the need to uninstall/install the mod.
- Full responsive videos keeping the aspect ratio.
- Compatible with Breeze

And example of an SMF 2.1 forum topic with several youtube videos can be found here: http://missallsunday.com/index.php?topic=21.msg4669#msg4669
Title: Re: Ohara YouTube Embed
Post by: Bigguy on November 13, 2015, 10:57:20 PM
Holy crap you just read my mind. I was just searchin around for this for a new site. I am tryin it right now.
Title: Re: Ohara YouTube Embed
Post by: babisim on November 15, 2015, 05:21:42 AM
hello /
i  use this mod Ohara YouTube Embed in my vb smf
this link of mod
link (http://custom.simplemachines.org/mods/index.php?mod=3268)
i add video in post it is all black screen just with youtube with vemo no probleme
note : the problme   just in the post smf version 2.0.1.0
                 thank for help me
Title: Re: Ohara YouTube Embed
Post by: Irisado on November 15, 2015, 06:01:28 AM
Babism, I've merged your topic with the mod support topic, as this is where you need to ask questions when you have an issue with a mod :).
Title: Re: Ohara YouTube Embed
Post by: babisim on November 15, 2015, 06:15:08 AM
hello
please help me   sweet Suki i instamm smf v 2.0.1.0  :(
 i use you  mod    i hav problem th  video you tube it is all black  in the  post
you can hepl me for resols this problem.
N.B: the védeo vemo it is good ready.

                             thankx
Title: Re: Ohara YouTube Embed
Post by: babisim on November 15, 2015, 06:56:36 AM
Babism, I've merged your topic with the mod support topic, as this is where you need to ask questions when you have an issue with a mod :).
thank you  Irisado
Title: Re: Ohara YouTube Embed
Post by: margarett on November 15, 2015, 05:30:43 PM
Most likely you have a javascript conflict as explained here
http://www.simplemachines.org/community/index.php?topic=462968.msg3821245#msg3821245
Title: Re: Ohara YouTube Embed
Post by: c0m4r1 on November 18, 2015, 06:42:44 AM
Hello
I used ohara mod since about 2013 and everything was ok, lastly i decided to upgrade mod to help users adding new video and after upgrading mu admin page doesnt work. only mysite_com/admin doesnt work, if i choose any of the admin page it works but main admin dashboard doesnt.
On all tested browsers i get internal error 500.
Now i dont know what to do now :/ Should i delete the mod and install some old version ? where should i look for some errors ? In apache log i couldnt find anything related to /admin path

Title: Re: Ohara YouTube Embed
Post by: Suki on November 20, 2015, 03:41:07 PM
There is no /admin page in SMF

Just use your FTP program to change the permissions to whatever page you want back to 755 or whatever permission level your server is configured at.
Title: Re: Ohara YouTube Embed
Post by: LOPar on December 23, 2015, 09:30:48 AM
He meant http://forum.name/index.php?action=admin. Mod creates error500 on that page, but other admin pages work perfect.
Title: Re: Ohara YouTube Embed
Post by: Suki on December 23, 2015, 01:30:57 PM
Its a permissions thing, something that happens on very picky hosts, my current hosts its also like that  but I cannot really figure it out why only this mod triggers those 500 errors.

I use a similar structure across all my mods, normalization and all that stuff, meaning I use the same mod/folder structure on all my mods and yet this is the only one who has this permissions issues.

Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 04:47:30 PM
Hi Suki,

Your mod worked fine for me as long as I had it installed, but after I uninstalled it, I've only got a 500 server error from my forum. What do you think happened, and how might I get my forum up and running again?
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 04:52:33 PM
Hi and welcome to SMF.

Change your index.php permissions back to whatever your server needs, usually 644 for files on picky servers.

There should be some doc about FTP and permissions on the wiki to help you with that.
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 05:54:09 PM
BlueHost and I both tried that, it didn't help.
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 05:58:27 PM
Theres some file or dir with messed up permissions, index.php its the most common thats why I suggested it but also check any other file/dirs any FTP client should tell you the permissions for any file/dir,make sure they are set as 644 for files and 755 for directories.
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 06:00:18 PM
BlueHost set all files to 644 and all directories to 755 as part of their diagnostic, it didn't help.
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 06:06:26 PM
Whats your forum url?  Did you verify that your files are indeed with those permissions?
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 06:49:31 PM
http://thekorribanoutpost.com

Just checked, took a while, but yeah.
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 08:00:02 PM
OK, if permissions isn't the issue then theres a PHP error somewhere.

I just have the same error in my own site (ironically while trying to fix these pesky 500 permissions error in SMF 2.1) and all permissions were fine but there was a php error in a file totally unrelated to this mod.

So check your error_log, not the one form SMF but the one called error_log  that file should appear in your forum's root folder and can be opened by any text editor.

Take a look at it and see if there is any error logged there.

Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 08:14:18 PM
There are two different types of errors from today. The latter is repeated about a hundred times:

Quote
[02-Jan-2016 15:32:28 Africa/Abidjan] PHP Warning:  Cannot modify header information - headers already sent in /home3/***/public_html/sith/Sources/Errors.php on line 346

[02-Jan-2016 21:25:49 Africa/Abidjan] PHP Fatal error:  Call to undefined function OYTE_Preparse() in /home3/***/public_html/sith/Sources/Subs.php on line 928
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 08:16:28 PM
Yep, that should be the one causing this whole issue, attach your /Sources/Subs.php file

I also edited out your name from the path you provided.
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 08:32:11 PM
And how does one go about that? I'm very new to the manual side of things, for eight years I let a co-admin do the php and css, this is my first solo venture with SMF.

Thanks for the edit.
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 08:36:20 PM
OK, are you familiar with FTP or using your cPanel file manager?

The file I mentioned should be located inside your Sources directory, from the path you provided, you installed SMF in a dir named "sith" so go to that dir and you should be able to see the Sources dir, enter that dir and you wil be able to see a list of files, look for one named Subs.php
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 08:47:47 PM
Or did you literally mean attach the file here?
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 08:51:54 PM
Yes, download the file and attach it here using the forum's attach system.
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 09:10:12 PM
I was on mobile, here you go.

There were also Subs.php.old2 and Subs.php~ files, do those matter?
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 09:43:49 PM
Try the attached file.

Subs.php~  its a back up file, those are created when you install a mod.

Subs.php.old2  its probably an old file someone else renamed.
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 09:53:00 PM
No change. :'(

I gave you the Subs.php file from "Sources," within my "sith" directory, was that correct?
Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 09:54:43 PM
Check your error log again, that error should be gone. perhaps the other error is also causing issues.
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 09:58:16 PM
It worked, actually. I'd been in the wrong directory.
Title: Re: Ohara YouTube Embed
Post by: Eli McGowan on January 02, 2016, 10:02:02 PM
Thank you! :')

Title: Re: Ohara YouTube Embed
Post by: Suki on January 02, 2016, 10:14:40 PM
Oh cool and I'm actually am on my way to watch the new star wars movie :p haha what a coincidence! 

Glad it worked,  will keep on checking to see why this mod in particular causes so many issues
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on January 03, 2016, 08:02:59 AM
"I find your lack of faith... Disturbing"
;D
Title: Re: Ohara YouTube Embed
Post by: Matthew K. on January 19, 2016, 07:04:16 PM
Because you use "integrate_menu_buttons" to load your JavaScript and CSS, any forum (especially big forums) that want to use this mod, it will not load videos if they have any level of caching that caches the menu buttons. Since integrate_menu_buttons hook is inside the loading of menu buttons, the resources will only be loaded the hits that the buttons are cached and re-cached, which is not very often without doing it manually. Therefore, anywhere that wants to use this auto-embedding will have blank divs showing up in their posts with no iFrames. Honestly, you should probably be using integrate_theme_include for your JavaScript and CSS files, and then find better places to add your JS variables (width / height), and either add credits hack manually, or once again, a better spot.
Title: Re: Ohara YouTube Embed
Post by: c0m4r1 on February 18, 2016, 11:36:54 AM
I am sorry for my absence but was busy past months. I am glad that you have found solution but maybe you could provide some more information how to fix it ? Or maybe i can attach my Subs.php and you could check it ?
There is another problem with your mod - yt videos are not visible for logged in users. If you are logout, yt videos in iframe are ok. It is caused by jquery.min which is called before jquery-1.9.1.min
Didnt find piece of code responsible for this but maybe you know where can i find it ?
Title: Re: Ohara YouTube Embed
Post by: Suki on February 18, 2016, 02:19:43 PM
New version. 1.2.5

- Added support for imgur gifv format
- Move the css and js calls to integrate_load_theme hook.

imgur gifvs won't work with microsoft Edge browser, it does work with firefox/chrome/opera.

To upgrade just uninstall any previous version and install the new one.


@c0m4r1  The 500 issue is related to permissions, just be sure to set every file back to 644 and your folders back to 755  if for some reason your main public_html folder was changed too and you don't have FTP access to change it, talk to your host to get it restored.

Check your server error log too, there has to be some info about this there.

The youtube videos not visible for logged users is a jquery conflict with another mod, unfortunately, a lot of mod authors doesn't check if there is a jquery version already been used (or the version they are using its pretty old), they just add their own, this causes all kinds of issues with mods that uses jquery. There is no simple solution for this, needs to be debugged site per site but a list of installed mods will be a great start.
Title: Re: Ohara YouTube Embed
Post by: Matthew K. on February 19, 2016, 06:26:16 PM
You're welcome ;) :)
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 22, 2016, 01:26:25 AM
I really want to use this mod for the gifv support, but I already have thousands of posts on the forum that use the Aeva embed.
With Aeva you just pasted the youtube url and would embed, is this possible with this mod too? (So I can remove aeva and only use this mod)
(I don't want the two mods conflicting, would rather use one mod)

Ideally I can embed youtube automatically, and gifv with [] tags. Then I would switch to this mod instantly  ;D
Title: Re: Ohara YouTube Embed
Post by: Matthew K. on February 22, 2016, 09:54:13 AM
This modification can automatically embed YouTube videos from just inserting their links. You can also use [youtube][/youtube] tags as well, but they are optional.
I really want to use this mod for the gifv support, but I already have thousands of posts on the forum that use the Aeva embed.
With Aeva you just pasted the youtube url and would embed, is this possible with this mod too? (So I can remove aeva and only use this mod)
(I don't want the two mods conflicting, would rather use one mod)

Ideally I can embed youtube automatically, and gifv with [] tags. Then I would switch to this mod instantly  ;D
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 22, 2016, 11:37:21 AM
This modification can automatically embed YouTube videos from just inserting their links. You can also use [youtube][/youtube] tags as well, but they are optional.
I really want to use this mod for the gifv support, but I already have thousands of posts on the forum that use the Aeva embed.
With Aeva you just pasted the youtube url and would embed, is this possible with this mod too? (So I can remove aeva and only use this mod)
(I don't want the two mods conflicting, would rather use one mod)

Ideally I can embed youtube automatically, and gifv with [] tags. Then I would switch to this mod instantly  ;D
My bad!



I installed the mod, but no functionality has been added to the forum, and "Modification Settings" is empty.. How do I fix this?
(No errors popped up during install)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FLvusEWW.png&hash=194a3187f1a2b64ff042eab070d4a5f9)
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 23, 2016, 04:27:53 AM
I managed to fix it, something went wrong during installation..



New question: How do I stop the "preload" image, I just want the normal youtube embed.
New question #2: How do I left align the videos? (they are centered now)
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 23, 2016, 05:49:25 AM
I managed to fix it, something went wrong during installation..



New question: How do I stop the "preload" image, I just want the normal youtube embed.
New question #2: How do I left align the videos? (they are centered now)Fixed in CSS
Bug: Gifv's are not working on mobile...  :( (iPhone)
Can you please make it work on mobile phones? Imgur's gifv's do work on mobile.
Title: Re: Ohara YouTube Embed
Post by: Suki on February 23, 2016, 11:29:34 AM
Its gonna be tricky, theres a whole silly thing with browsers supporting only their preferred formats, besides I don't own any apple product so its going to be difficult to debug this.
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 23, 2016, 11:50:42 AM
Its gonna be tricky, theres a whole silly thing with browsers supporting only their preferred formats, besides I don't own any apple product so its going to be difficult to debug this.
Does it work on Android for you?
If I can help in any way, please let me know.
I actually really like your mod, and it's the ONLY one with gifv support, mobile support would make this mod 100% complete for me  :D
Title: Re: Ohara YouTube Embed
Post by: Suki on February 23, 2016, 01:43:45 PM
I s till haven't test it, my site is running SMF 2.1 and I have a totally different mod version for that SMF version only and I still haven't properly update it, onces I got it solved I will be able to test it on Android although since most people uses chrome it will have the same disadvantages every other chrome browser has.
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 23, 2016, 01:53:23 PM
I s till haven't test it, my site is running SMF 2.1 and I have a totally different mod version for that SMF version only and I still haven't properly update it, onces I got it solved I will be able to test it on Android although since most people uses chrome it will have the same disadvantages every other chrome browser has.
Should I update to 2.1 then?
Also I found a small bug; when you embed a youtube video like https://www.youtube.com/watch?v=sZ_p0bkPJ5U&gl=BE the gl=BE gets pasted after the embedded video, you should just remove everything after the & probably.
Title: Re: Ohara YouTube Embed
Post by: Suki on February 23, 2016, 04:05:40 PM
No, you shouldn't upgrade to 2.1 just for this.

I'm aware of that bug, unfortunately it is more than just "removing everything after the &" as not all urls follows that format, when I change the regex I gotta make sure it will work for the url formats I support.
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 25, 2016, 01:04:09 AM
No, you shouldn't upgrade to 2.1 just for this.

I'm aware of that bug, unfortunately it is more than just "removing everything after the &" as not all urls follows that format, when I change the regex I gotta make sure it will work for the url formats I support.

Reporting a few more minor bugs:

https://www.youtube.com/watch?time_continue=3&v=3TZdIaNaTH0

Links with this also do not work.

https://youtu.be/Xm_dS-wEFvs

Same for youtu.be
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on February 25, 2016, 01:31:31 AM
For the second one, add "https://youtu.be/" and "http://youtu.be/" into your censored words and replace them with "https://youtube.com/watch?v="
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 25, 2016, 10:01:32 AM
^ Thank you for that temporary solution!

Suki I've also noticed that old youtube links aren't being embedded
Example: http://forums.themavesite.com/index.php?topic=30600.0

(with Aeva it used to be embedded)
Title: Re: Ohara YouTube Embed
Post by: Suki on February 25, 2016, 11:48:13 AM
Don't use the censor feature as that will only increase the server burden.

The issue is related to special chars such as - and _ on the urls and not with the url format itself. Will release a new version to add support for those chars.

As for old youtube links, make sure they aren't surrounded by any BBC tags, this particular url is a standard one   supported by the mod already.

When an url doesn't get automatically embeded it almost always means there is another bbc tag on them, this mod automatically skips urls inside bbc tags.

Also, bear in mind that it will be almost impossible to caught every single youtube url out there, things like time elapse, time starting and any other special youtube params will most likely not be supported.
Title: Re: Ohara YouTube Embed
Post by: themavesite on February 26, 2016, 04:30:04 AM
Don't use the censor feature as that will only increase the server burden.

The issue is related to special chars such as - and _ on the urls and not with the url format itself. Will release a new version to add support for those chars.

As for old youtube links, make sure they aren't surrounded by any BBC tags, this particular url is a standard one   supported by the mod already.

When an url doesn't get automatically embeded it almost always means there is another bbc tag on them, this mod automatically skips urls inside bbc tags.

Also, bear in mind that it will be almost impossible to caught every single youtube url out there, things like time elapse, time starting and any other special youtube params will most likely not be supported.

Could you support
Code: [Select]
[url=http://www.youtube.com/watch?v=0sTTGlqZDx0]http://www.youtube.com/watch?v=0sTTGlqZDx0[/url] the url BCC tag? As all my old youtube links have this :/
Title: Re: Ohara YouTube Embed
Post by: Suki on February 27, 2016, 10:57:18 AM
Not really, at least not without some impact on performance.

SMF treats any link and automatically adds the url tags, theres nothing wrong with that, now, if a mod wants to prevent that then any auto embed url must be wrapped with another bb tag, precisely to prevent SMF's default behavior.  This is why this mod wraps all valid single urls with their respective BBC tags, this way if you uninstall this mod, all embedded urls will not be wrapped by url tags and another embed mod can then come and do their job just fine without worrying about url tags.
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 03, 2016, 02:37:58 PM
@Suki

Would you mind reminding me of the tweak(s) to stop video links being touched in a simple portal shoutbox?
Ideally, all links posted in it would just display as "[link]"

I've got the latest version installed and get these results when I try to 'shout' these:

"https://www.youtube.com/watch?v=w3ugHP-yZXw" - doesn't appear to know I clicked 'shout'
"http://www.youtube.com/watch?v=w3ugHP-yZXw"  - doesn't appear to know I clicked 'shout'
"www.youtube.com/watch?v=w3ugHP-yZXw" - displays "[link]" <-- looking to achieve this for all.
"text here https://www.youtube.com/watch?v=w3ugHP-yZXw" - displays as: "text here [youtube]https://www.youtube.com/watch?v=w3ugHP-yZXw[/youtube]"
"text here www.youtube.com/watch?v=w3ugHP-yZXw" - displays as: "text here [link]"


Many thanks and congrats on your new role btw!  ;)
Title: Re: Ohara YouTube Embed
Post by: Suki on March 04, 2016, 10:47:51 AM
Its just a matter of adding this:

$context['ohara_disable'] = true; 

Before the call to your shoutbox,  but it depends on how you are adding your shoutbox, if its a php block or a pre-made one, if its a premade one then you will have to modify simpleportal code to add that code just before the shoutbox messages are being parsed via parse_bbc()
Title: Re: Ohara YouTube Embed
Post by: 420Connect.co.uk on March 04, 2016, 11:28:38 AM
Its just a matter of adding this:

$context['ohara_disable'] = true; 

Before the call to your shoutbox,  but it depends on how you are adding your shoutbox, if its a php block or a pre-made one, if its a premade one then you will have to modify simpleportal code to add that code just before the shoutbox messages are being parsed via parse_bbc()

Nice One Suki!  ;)

I knew it wasn't a big tweak!

...

*Leaves myself a little note for next time*

in Sources/Subs-Portal.php
Find:
Code: (find) [Select]
$context['aeva_disable'] = true;
Code: (replace) [Select]
$context['aeva_disable'] = true;

$context['ohara_disable'] = true;

O:)
Title: Re: Ohara YouTube Embed
Post by: captainspud on March 18, 2016, 07:58:34 PM
I'm having some issues with the mod-- it detects my YouTube URLs and tries to replace them, but only builds black boxes instead of video embeds. Screenshot attached.

Any idea what I did wrong? I'm on v.2.0.11 and downloaded the mod today.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 19, 2016, 01:28:02 PM
Most likely a JS error, check your console log to see if there is any error, a link to a page/topic with a video on it might help too.

Unfortunately, theres little I can do about this kinf of errors since I don't control the way other mod authors add JavaScript code or which libraries they include.
Title: Re: Ohara YouTube Embed
Post by: captainspud on March 19, 2016, 02:26:24 PM
1) No errors have popped up in the log since before I installed your mod.

2) I have three mods on my site-- a gallery mod that shouldn't affect posting, your mod, and a WYSIWYG editor mod. I thought the editor mod might be adding junk around the link, but when I look the post up in the DB there's nothing more than what shows up in the post editing box.

3) An example can be seen in the first reply in this thread:

http://www.captainspud.com/forum/index.php?topic=15.0

His post is trying to embed https://youtu.be/GzBxEZOBTGg, between [youtube][/youtube] tags.

Thanks for taking a look at it. :)
Title: Re: Ohara YouTube Embed
Post by: Suki on March 19, 2016, 02:57:24 PM
By console log I mean the console from the dev tools you have in your screenshot.


It looks like you have a JS error:  "Uncaught TypeError: Cannot read property 'setTextMode' of undefined"  which points out to this line of code:

$(smfmod_editor).data("sceditor").setTextMode();

That error is preventing this mod's JS form running which is why you only see a black box.  Onces that error is gone your videos should play normally.
Title: Re: Ohara YouTube Embed
Post by: captainspud on March 19, 2016, 11:24:49 PM
Ah, gotcha.

I did some digging for reports of that error, and found this thread (http://www.simplemachines.org/community/index.php?topic=496688.130;wap2). I made the change outlined in the first post, and my YouTube videos started snapping into place.

Thanks for pointing me in the right direction-- I never thought to check the JS error log. :)
Title: Re: Ohara YouTube Embed
Post by: AlexMnrs on April 05, 2016, 05:15:05 PM
I'm having some issues with the mod-- it detects my YouTube URLs and tries to replace them, but only builds black boxes instead of video embeds. Screenshot attached.

Any idea what I did wrong? I'm on v.2.0.11 and downloaded the mod today.

I have the same issue as you. The weird thing is that regular members and visitors can see the videos without problem, but not me (administrator).

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FZHRW11q.png&hash=de420dc91a2850bfab89adcb88d70e65)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FCP5WJsw.png&hash=b8fe414cfca40a9afafd74901c6695dc)

You get it fixed?

Edit. FIXED.

Code: [Select]
var $m = jQuery;
var _oh=function(){this.masterDiv=$m(".oharaEmbed");this.basedElement=this.masterDiv.parent();this.defaultWidth="undefined"!==typeof _ohWidth?_ohWidth:480;this.defaultHeight="undefined"!==typeof _ohHeight?_ohHeight:270;this.aspectRatio=this.defaultHeight/this.defaultWidth;this.main();this.responsive()};
_oh.prototype.main=function(){$this=this;$m(".youtube").each(function(){var b=this.id.replace("oh_",""),a=$this.getImage(b),c=$this.basedElement.height(),d=$this.basedElement.width();"undefined"!==typeof a&&$m(this).css({"background-image":"url("+a+")","background-size":"cover"});$m(this).append($m("<div/>",{"class":"youtube_play"}));$m(this).one("click",function(){var a="//www.youtube.com/embed/"+b+"?autoplay=1&autohide=1";$m(this).data("params")&&(a+="&"+$m(this).data("params"));a=$m("<iframe/>",{frameborder:"0",
src:a,width:d,height:c});$m(this).css({"background-image":"none"}).append(a);$m(this).children(".youtube_play").css({height:"0"});$this.responsive()})})};_oh.prototype.responsive=function(){$this=this;$m(window).resize(function(){var b=$this.basedElement.width(),a=b*$this.aspectRatio<=$this.defaultHeight?b*$this.aspectRatio:$this.defaultHeight,c=b<=$this.defaultWidth,d=c?b:$this.defaultWidth,e=c?a:$this.defaultHeight;$this.masterDiv.width(d).height(e);$m(".oharaEmbed > iframe").each(function(){$m(this).width(d).height(e)})}).resize()};
_oh.prototype.refresh=function(){$this=this;setTimeout(function(){$this.main()},3E3);setTimeout(function(){$this.responsive()},3E3)};_oh.prototype.getImage=function(b){var a="",c,d,e=["hqdefault","mqdefault","sddefault","maxresdefault"];c=0;for(d=e.length;c<d&&(a="//i.ytimg.com/vi/"+b+"/"+e[c]+".jpg",0==a.width);++c);0==a.width&&(a="//i.ytimg.com/vi/"+b+"/default.jpg");return a};(function(b){b(function(){var a=new _oh;b("input[name=preview]").on("click",function(){a.refresh()})})})(jQuery);

Either now I have new problem:

(https://i.imgur.com/vLFCNE1.png)
Title: Re: Ohara YouTube Embed
Post by: Suki on April 05, 2016, 06:00:57 PM
Its not really the same problem, in your case a different mod is causing conflicts, take a look at the ncode resizer mod, thats the one causing JS errors.

The reason why only you have errors is because the specific code that generates JS errors is only displayed to you and not your regualr members or guests.


You shouldn't really modify the ohara min file, that file has been minified and if you modifiy it more issues will appear, the best thing you can do is fix the issue with the other mod.


Edit, apparently you have removed my copyright link from your credits page, while thats completely legal, I reserve my right to provide support for those who had removed my copyright.
Title: Re: Ohara YouTube Embed
Post by: AlexMnrs on April 06, 2016, 03:33:44 PM
Edit, apparently you have removed my copyright link from your credits page, while thats completely legal, I reserve my right to provide support for those who had removed my copyright.

I haven't removed nothing. Your mod not added new lines on my footer. And I've tried to get it back making a new install of Ohara but no luck.
Title: Re: Ohara YouTube Embed
Post by: Grammy on May 02, 2016, 11:59:48 AM
Hi,

Your mod installed beautifully into 2.0.11 default with the package manager and works just fine; thanks so much!  I wanted to ask if an edit will allow the video to be viewed fullscreen?  I searched this thread and did see where one user achieved it but the section of code he/she specified doesn't seem to appear in the files inside the zip and I didn't want to break anything, since I am not proficient in file editing.  I thought it might be wiser to come here and simply ask, if you don't mind?

Thank you.   :)
Title: Re: Ohara YouTube Embed
Post by: Grammy on May 03, 2016, 06:22:31 PM
Hi,

Your mod installed beautifully into 2.0.11 default with the package manager and works just fine; thanks so much!  I wanted to ask if an edit will allow the video to be viewed fullscreen?  I searched this thread and did see where one user achieved it but the section of code he/she specified doesn't seem to appear in the files inside the zip and I didn't want to break anything, since I am not proficient in file editing.  I thought it might be wiser to come here and simply ask, if you don't mind?

Thank you.   :)

Or maybe you could tell me which file?  That might help.   :)
Title: Re: Ohara YouTube Embed
Post by: Suki on May 03, 2016, 06:54:27 PM
open you /Themes/default/scripts/ohyoutube.min.js file find this:

{frameborder:"0",


and replace it with this:

{allowfullscreen:"allowfullscreen",frameborder:"0",

Will release a new version to fix this.
Title: Re: Ohara YouTube Embed
Post by: Grammy on May 03, 2016, 09:44:02 PM
Oh, thank you, that worked beautifully!  It's a great mod, thanks so much.   :)
Title: Re: Ohara YouTube Embed
Post by: Geor'G on May 05, 2016, 03:46:55 PM
The spoiler is not working.
Do not expose the size of the width and height.

RU:
В спойлере не работает.
Не выставляет размер ширины и высоты.

UPD:
Fix to work with spoiler:
Code: [Select]
if (applyWidth <= 0 && applyHeight <= 0) {
applyWidth = $this.defaultWidth;
applyHeight = $this.defaultHeight;
}

Title: Re: Ohara YouTube Embed
Post by: Geor'G on May 06, 2016, 02:33:05 AM
Sorry, I found at fault.
Your creaking and.

RU:
Сорри, нашёл у себя ошибку.
Ваш скрип не причем.
Title: Re: Ohara YouTube Embed
Post by: Grammy on May 23, 2016, 09:17:56 PM
Hi, I've not seen this mentioned on this thread but, now that I'm ready to open my forum, I remembered an issue that I was just working around, in my test forum.  When I click either the YouTube or the Vimeo BBC button, I only get the first half of the tags.  For instance, clicking the YouTube BBC button only puts this:  [youtube] or [vimeo] in the posting area.  [/youtube] and [/vimeo] closing tags do not appear.  Is this maybe an installation glitch (and would require my uninstalling and reinstalling) or is there a file I could check?

Thanks so much.   :)


EDIT:  Ah....  you must put the link into the post first, highlight it and THEN when you click the BBC button, you get both tags.  I guess I'm used to another format elsewhere, where both tags appear and then you place your content between them.  All that to say a very sheepish "Never mind....."    :-[
Title: Re: Ohara YouTube Embed
Post by: Suki on May 29, 2016, 11:37:58 AM
A new version has been released:

1.2.6 - May 29, 2016,
- Add support for full screen videos.
- Remove multiple calls to this.responsive().
- Check the width and height of parent div before applying changes.


To upgrade just uninstall any previous version and install the new one and don't forget to check the "Install in Other Themes" checkboxes for all your installed themes.
Title: Re: Ohara YouTube Embed
Post by: Kardamilas on June 07, 2016, 07:18:07 AM
Goodevening

i installed the mod,is working great but it gives me
that when i press "reply"

I dont know if i should ask here or on my theme support forum.
Has anyone face that?

Title: Re: Ohara YouTube Embed
Post by: lucske on June 07, 2016, 06:52:48 PM
Hi Suki,

Thanks for this fantastic mod !
I only have a small problem with the videosize.
The preview picture of the embedded video shows up correctly in the topic.
Bud then it starts playing an i only see 1/4 th of the video.
I see the top-left part of it...
Then when i double-click the video it becomes full screen and when i close
the full screen then it shows the correct size inside the box in the topic.
Why is this happening ?
Can i do something about it ?
Thanks in advance for your reply...

Luc
SMF2.0.11
Title: Re: Ohara YouTube Embed
Post by: Suki on June 16, 2016, 11:21:37 AM
Goodevening

i installed the mod,is working great but it gives me
that when i press "reply"

I dont know if i should ask here or on my theme support forum.
Has anyone face that?



You need ot add the BBc images this mod includes on whatever theme you are using.

Or uninstall the mod, install it again and check ALL checkboxes for all the themes you currentyl have installed.


Hi Suki,

Thanks for this fantastic mod !
I only have a small problem with the videosize.
The preview picture of the embedded video shows up correctly in the topic.
Bud then it starts playing an i only see 1/4 th of the video.
I see the top-left part of it...
Then when i double-click the video it becomes full screen and when i close
the full screen then it shows the correct size inside the box in the topic.
Why is this happening ?
Can i do something about it ?
Thanks in advance for your reply...

Luc
SMF2.0.11

I will need a link to see it.
Title: Re: Ohara YouTube Embed
Post by: lucske on June 16, 2016, 12:04:47 PM
Hi,
Here's a link to an embedded youtube film.
http://keyforum.eu/Forum/index.php?topic=6.0
Hope you can see it...

Solong,
Luc
Title: Re: Ohara YouTube Embed
Post by: Suki on June 16, 2016, 01:11:02 PM
Guest cannot see your forum.  Either make it temp visible for guest or pm a dummy regualr user account.
Title: Re: Ohara YouTube Embed
Post by: lucske on June 16, 2016, 03:13:31 PM
I send you a pm ...

Luc
Title: Re: Ohara YouTube Embed
Post by: lucske on June 19, 2016, 10:34:43 AM
Have you been able to log in with the login i sendet you in PM ?
Title: Re: Ohara YouTube Embed
Post by: Suki on June 20, 2016, 11:57:03 AM
Does it happen with every video?

Does the video you are trying to embed has some special settings for displaying?

The video on your link has a predefined width and height of 652 and 424, thats what its been displayed directly from youtube, this mod cannot overwrite that for some reason.

So if you own the youtube channel try and take a look at its settings  or change the mod's width and height to match the ones from your videos
Title: Re: Ohara YouTube Embed
Post by: lucske on June 20, 2016, 12:31:01 PM
Hi Suki,

This happens with every video.
Some are in hd, some are not.
The one you watched (imagine) is in hd.
But there are others in the same topic (on stage) that are in different format but also have the problem...
I tryed to change the mod setting, but had to make it almost full screen for it to display the whole video...
The default size is the nicest one for the forum so i would like to keep that size.
Is there anything you can do so the video resises to the size of the window ?
Thanks for youre trouble...

Luc
Title: Re: Ohara YouTube Embed
Post by: Suki on June 20, 2016, 12:34:33 PM
What I mean is if this happen with any other video?  post a random vidoe from youtube, does this happen too?

Do you have any other youtube video mod installed?
Title: Re: Ohara YouTube Embed
Post by: lucske on June 20, 2016, 01:02:44 PM
Yes, it happens with all video's
Even video's like movietrailers give the same result.
If you can watch again now i put a trailermovie in the same topic as imagine...
So any movie from youtube results in partial viewing...
No other youtube mod is installed...

Thanks

Luc
Title: Re: Ohara YouTube Embed
Post by: golimaar on June 20, 2016, 01:54:53 PM
I am trying to install ohara youtube code, but i am getting an the following error.

You cannot download or install new packages because the Packages directory or one of the files in it are not writable!
Title: Re: Ohara YouTube Embed
Post by: Suki on June 21, 2016, 02:15:13 PM
Yes, it happens with all video's
Even video's like movietrailers give the same result.
If you can watch again now i put a trailermovie in the same topic as imagine...
So any movie from youtube results in partial viewing...
No other youtube mod is installed...

Thanks

Luc

How are you embeding the links?

Do you have any other youtube related script/mod/etc?
Title: Re: Ohara YouTube Embed
Post by: themavesite on June 28, 2016, 02:45:46 PM
GIFV's suddenly aren't displayed any more, posts are blank for me :/
Example: http://forums.themavesite.com/index.php?topic=31946.new#new
Title: Re: Ohara YouTube Embed
Post by: Suki on June 29, 2016, 01:38:16 PM
I just tested the mod and it works just fine : missallsunday.com/test/index.php?topic=12.0

how are you embedding it?  whats the url you're trying to use?
Title: Re: Ohara YouTube Embed
Post by: themavesite on June 29, 2016, 02:02:34 PM
I just tested the mod and it works just fine : missallsunday.com/test/index.php?topic=12.0

how are you embedding it?  whats the url you're trying to use?

http://i.imgur.com/srjx6wP.gifv

Just like that, the url.
What could be wrong?
Title: Re: Ohara YouTube Embed
Post by: themavesite on June 30, 2016, 01:43:38 AM
I just tested the mod and it works just fine : missallsunday.com/test/index.php?topic=12.0

how are you embedding it?  whats the url you're trying to use?

http://i.imgur.com/srjx6wP.gifv

Just like that, the url.
What could be wrong?

You can even right click the blank post and select "view video", but the gifvs don't display themselves :/ All white

http://forums.themavesite.com/index.php?topic=31946

http://forums.themavesite.com/index.php?topic=1593.new#new -> Only one gifv on this page works..
Title: Re: Ohara YouTube Embed
Post by: Suki on July 01, 2016, 09:41:48 AM
Yeah, it seems the mod is correctly parsing the gifv but for some reason it isn't displayed by the browser, I have no idea why.
Title: Re: Ohara YouTube Embed
Post by: themavesite on July 02, 2016, 01:52:09 PM
Yeah, it seems the mod is correctly parsing the gifv but for some reason it isn't displayed by the browser, I have no idea why.
So what do I do now? :|
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on July 02, 2016, 02:10:42 PM
Quote
http://i.imgur.com/B9jtcKt.gifv Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/XBS7kaV.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/pWuVUn7.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/xbg5ivQ.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/IFEbJaE.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/BLqj1nc.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/2tS7WAS.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/mG6BofC.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/nBrxkAi.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/qOSi48F.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
When you click those, they redirect to a .gifv file, just like the one that actually displays on the site.
Not sure why it throws a 404 on most of those, though, the link is correct ._.
Title: Re: Ohara YouTube Embed
Post by: bob799 on July 05, 2016, 10:59:11 AM
Basically I have a problem when embeding youtube videos. It is only displaying a black screen and no video is playing or coming up? When I try vimeo it is fine the vimeo video displays and plays but with long black borders either side of it. Attached image below.

(https://s3.amazonaws.com/cbf123/images/problem.png)

I do not get this problem with any other theme such as default or any others and I have installed this mod properly for my custom theme.

My theme details are as follows.

Theme name: Bright
Author: Pipee
Theme type: responsive bootstrap

I purchased it from smftricks.com

It only seems to be a problem with that theme? I have contacted the theme author but not heard anything back yet. Can you help?
Title: Re: Ohara YouTube Embed
Post by: bob799 on July 06, 2016, 05:19:34 AM
I discovered that this mod is definately not compatible with some themes.

The following is the code below is what I see in firefox from the other themes that work with this mod.

<div id="oh_OOgpT5rEKIU" class="oharaEmbed youtube" style="width: 480px; height: 270px; background-image: url("//i.ytimg.com/vi/OOgpT5rEKIU/hqdefault.jpg"); background-size: cover;">

The code below is what is being projected on my theme where it does not work.

<div style="width: 480px; height: 270px;" id="oh_OOgpT5rEKIU" class="oharaEmbed youtube"></div>

Anyone that can fix this for the Bright theme? as I have had no replies yet.
Title: Re: Ohara YouTube Embed
Post by: Suki on July 06, 2016, 09:52:56 AM
This mod is compatible with all themes, unfortunately, there are external factors that can cause issues.

If you take a look at past support issues, 99% of them are related to external js scripts preventing this mod to work properly. Your case is the same, theres a conflict somewhere in that theme's js files.

It could be several things:

A js issue.
An old jquery version.
A theme or a mod wrongly loading jquery without checking if it has been already loaded before.
A mod overwriting the $context var used by this mod to inject the needed js and css files.

I have no control over what other mod or theme authors do.

Will need to take a look at a link to a page with an embedded video with the problematic theme on.
Title: Re: Ohara YouTube Embed
Post by: bob799 on July 06, 2016, 10:51:13 AM
No worries I will just remove the mod. I have no free time to sort it out as I run a very busy, business. Will probably pay one of my technicians to have a look in a couple of weeks when it is quieter.

Thank you anyway.
Title: Re: Ohara YouTube Embed
Post by: coltp45 on July 15, 2016, 02:53:14 PM
Hi Suki i have the same problem with the videos image. 



Before update the mod the videos shows great but after update to the last version no matters the width and height I see the same. 

The portal have one video.
http://www.futbol-argento.com.ar/index.php

Title: Re: Ohara YouTube Embed
Post by: Suki on July 17, 2016, 10:17:17 AM
Ca you post  alink to a specific post where this is happening?
Title: Re: Ohara YouTube Embed
Post by: coltp45 on July 18, 2016, 11:43:24 AM
Ca you post  alink to a specific post where this is happening?

http://www.futbol-argento.com.ar/index.php/topic,74.1950.html

But the problem is in all the forum.
Title: Re: Ohara YouTube Embed
Post by: Rock Lee on July 18, 2016, 08:54:24 PM
time updated to the new version mod did not give me problems now suddenly black screen appears me, but you hear background ... Changing the zoom with ctrl and + makes video appears smooth :/


Regards!

Edit:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fuploadpie.com%2Fclkll&hash=577812466291469ba126cfb10766285e)

Although I'm not sure if it is modifying itself... "Failed to load resource: the server responded with a status of 404 (Not Found)" It is my theme, part of youtube but it never repair that part out the other 3 not (It will bring some kind of problem if I use an old version of mod?)
Title: Re: Ohara YouTube Embed
Post by: Suki on July 19, 2016, 12:20:51 PM
@coltp45, @Rock Lee  theres seems to be an issue with non-responsive themes, can you replace your /Themes/default/scripts/ohyoutube.min.js file with the one I'm attaching to see if the changes I made fixes this issues?

Be sure to clean your browsers cache or do a hard refresh (Control + F5)
Title: Re: Ohara YouTube Embed
Post by: coltp45 on July 19, 2016, 07:36:03 PM
Done Suki.

Works perfect now.
Thanks.
Title: Re: Ohara YouTube Embed
Post by: Rock Lee on July 19, 2016, 07:38:25 PM
@coltp45, @Rock Lee  theres seems to be an issue with non-responsive themes, can you replace your /Themes/default/scripts/ohyoutube.min.js file with the one I'm attaching to see if the changes I made fixes this issues?

Be sure to clean your browsers cache or do a hard refresh (Control + F5)

@Suki Perfectirijillo've ;) tried it with multiple browsers and apparently this solved the problem plays smoothly now!


Regards!
Title: Re: Ohara YouTube Embed
Post by: Coon on August 04, 2016, 03:25:57 PM
I've installed the mod and enabled it but my old posts are not converting from link to embedded video. I just did an upgrade from 1.1 to 2.0 and installed the 2.0 mod - I'm using the default theme.

Screenshots attached of what it looks like.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 04, 2016, 04:21:37 PM
Make sure the install was successful, it seems the file edits didn't get applied, check the mod's parser and make sure the edits were done.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 12, 2016, 12:56:34 PM
New version available.

1.2.7 - Aug 12, 2016,
- Set basedWidth and basedHeight to prevent weird behavior on non responsive themes.

To upgrade uninstall any previous versions and install the new one, if using a custom theme make sure to check its corresponding checkbox under "Install in Other Themes" when installing.
Title: Re: Ohara YouTube Embed
Post by: ninik on August 25, 2016, 07:18:45 AM

Hi Suki,

I installed the mod and although the vimeo video does play unfortunately the youtube window remains black and does not play at all???!!!

Could you please take a look and see what is wrong? the to a post link is: http:www.ancientgreecereloaded.com/files/ancient_greece_reloaded_website/forum/index.php/topic,232.0.html

From what I understood while looking at it, there was something wrong with your ohyoutube.min.js (in line 7); I guess...

I did also PM you...

I am looking forward to your reply, thanks in advance  :)

Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2016, 11:07:20 AM
Topics aren't visible for guests.

The blank window is a result of a JavaScript issue on your site, use your browser develop tools to see where the error is.  Most of the time is an old mod using old code or multiple mods trying to load Jquery multiple times.
Title: Re: Ohara YouTube Embed
Post by: ninik on August 25, 2016, 12:30:37 PM


Hi Suki thanks for your reply.

OK the problem appears to be this line here in the ohtoutube.min.js :



Code: [Select]
var _oh=function(){this.masterDiv=$(".oharaEmbed");this.basedElement=this.masterDiv.parent();this.defaultWidth="undefined"!==typeof _ohWidth?_ohWidth:480;this.defaultHeight="undefined"!==typeof _ohHeight?_ohHeight:270;this.aspectRatio=this.defaultHeight/this.defaultWidth;this.basedWidth=this.basedElement.width()>=this.defaultWidth?this.defaultWidth:this.basedElement.width();this.basedHeight=this.basedElement.height()>=this.defaultHeight?this.defaultHeight:this.basedElement.height();this.main();this.responsive()};



It says: ohyoutube.min.js:7 Uncaught TypeError: $ is not a function


Sorry if I am novice in that department...

Could you help me out with this code?

Thank you
Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2016, 12:56:51 PM
Its a side effect. Theres probably another mod that already loaded jquery and its not using $, instead it uses jQuery.

Open your /Sources/OharaYTEmbed.php

find this:

Code: [Select]
<script type="text/javascript" src="'. $settings['default_theme_url'] .'/scripts/ohyoutube.min.js"></script>
change it to this:

Code: [Select]
<script type="text/javascript" src="'. $settings['default_theme_url'] .'/scripts/ohyoutube.js"></script>

find your /Themes/default/scripts/ohyoutube.js  file

replace all instances of $ with jQuery.


Thats just a general approach, I don't know what other mods you are currently using.
Title: Re: Ohara YouTube Embed
Post by: ninik on August 25, 2016, 01:04:10 PM


Hi Suki, I did the first think asked.

In regards to the second,

you say "replace all instances of $ with jQuery."

What do you mean exactly, to replace the "$" with the word "jQuery"?

Sorry for the stupid question...  :-\

Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2016, 01:18:38 PM
Open that file with a code editor (notepadd++ is free and works well)  search for $ and replace with with jQuery, notepad++ has a feature to replace all instances of a word.  Save it, upload the file to the same location, clean your forums and browser cache.
Title: Re: Ohara YouTube Embed
Post by: ninik on August 25, 2016, 03:37:41 PM


Hi Suki, sorry for the delayed reply.

I did all the changes that you requested me to do, uploaded the files back to the server and had to wait for propagation to do its thing...

and... IT IS WORKING!!!  ;D

You are a genius Suki and I honestly thaaaaaaaaaaaaaank you!!!  :laugh:

Title: Re: Ohara YouTube Embed
Post by: oldcopy on September 18, 2016, 05:11:53 AM
SMF 2.1 beta 2 - not work.

Log:

The callable OharaYTEmbed::runTimeHooks could not be called.
Title: Re: Ohara YouTube Embed
Post by: d3vcho(); on September 18, 2016, 05:13:27 AM
This Mod (and almost every mod) is not meant to work with 2.1 yet (one of the reasons because SMF 2.1 has not been released). You'll have to wait for a future release.

Regards :)
Title: Re: Ohara YouTube Embed
Post by: oldcopy on September 18, 2016, 06:19:31 AM
I tried:

For those of you interested, I've been updating this mod to work and use some of the new features SMF 2.1 offers, so far this is the result. Attached is a beta of this mod for SMF 2.1, the new features include:

Installed mod without error, but does not work.
Title: Re: Ohara YouTube Embed
Post by: d3vcho(); on September 18, 2016, 06:22:07 AM
Oops! My bad. You should wait for Suki's answer then.

Have a nice day :)
Title: Re: Ohara YouTube Embed
Post by: Suki on September 18, 2016, 01:20:03 PM
@oldcopy  What package are you trying to install?

Make sure all files this mod needs are properly copied to their respective SMF folders.
Title: Re: Ohara YouTube Embed
Post by: FishingManMatt on October 22, 2016, 02:30:18 PM
Hi Suki, hi guys!

While browsing files on my server I stumbled upon the following code in the Post.php file:

Code: [Select]
// Let's see if there's still some content left without the tags.
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><iframe><div><iframe><div>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
$post_errors[] = 'no_message';

It turned out that the img tag was modified by the following mod's xml instructions:

Code: [Select]
<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA[<img>]]></search>
<add><![CDATA[<img><iframe><div>]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[<img>]]></search>
<add><![CDATA[<img><iframe><div>]]></add>
</operation>
</file>

In my Post.php file it looks like the img tag was replaced twice.

And the other img tag in this file (there are only two) is untouched:

Code: [Select]
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '')
{
$post_errors[] = 'no_message';
unset($_POST['message']);

I'm wondering if this is an installation bug or... maybe something went wrong during an update?
Title: Re: Ohara YouTube Embed
Post by: Suki on October 23, 2016, 09:47:44 AM
Its a bug on the mod, I believe I fixed it by having a wider search for code and make sure both places got covered. I dunno if I released that, I will have to check.  In the mean time, you can manually apply the change to both places or leave it as it is. This only affects you is you post a video and nothing more.
Title: Re: Ohara YouTube Embed
Post by: FishingManMatt on October 23, 2016, 10:19:02 AM
Many thanks Suki!
I've just can manually applied the change to both img tags.
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 23, 2016, 11:47:36 AM
this mod doesnt seems to convert links that start with https://m.youtube.com. how can i add that?
Title: Re: Ohara YouTube Embed
Post by: Suki on October 23, 2016, 11:51:33 AM
Yes, thats something I'm aware of, will check when I have some time. Tracked (https://github.com/MissAllSunday/OharaYouTubeEmbed/issues/9) in the meantime.
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 23, 2016, 11:54:17 AM
Yes, thats something I'm aware of, will check when I have some time. Tracked (https://github.com/MissAllSunday/OharaYouTubeEmbed/issues/9) in the meantime.
sawweeet. thanks bro dudette
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 24, 2016, 12:49:23 AM
Hey @Suki, I noticed someone said that to align the video tothe left you need to modify this file


Quote
In Sources/OharaYTEmbed.php find:

<div style="text-align:center;margin:auto;padding:5px;" class="youtube $1">

and replace with:

<div style="text-align:left;margin:auto;padding:5px;" class="youtube $1">
but i dont see that line anymore? how can i align the videos on the left? also for whatever reasons, imgur video (gifv) are not working for me .. not on chrome or firefox - not sure if you have any thoughts
Title: Re: Ohara YouTube Embed
Post by: Suki on October 24, 2016, 12:49:23 PM
Do you have some urls examples using the m.youtube format?

to make style changes, the mod adds its own .css file named oharaEmbed.css  the class you need to change is .oharaEmbed
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 24, 2016, 12:51:41 PM
Do you have some urls examples using the m.youtube format?

to make style changes, the mod adds its own .css file named oharaEmbed.css  the class you need to change is .oharaEmbed
yes here you go

https://m.youtube.com/watch?v=UU4TRlXbTDQ&feature=youtu.be



https://m.youtube.com/watch?v=L1vAyWcEoCs&feature=youtu.be

let me check that css file .. i think i totally missed that one
Title: Re: Ohara YouTube Embed
Post by: Suki on October 25, 2016, 10:18:44 AM
Try this one and let me know if m.youtube urls works. Just replace your file on Sources with the attached one.

  Also, do you have some examples of imgur gifv urls to test on?
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 25, 2016, 10:45:08 AM
Try this one and let me know if m.youtube urls works. Just replace your file on Sources with the attached one.

  Also, do you have some examples of imgur gifv urls to test on?
awesome!!! it works now!

here are an example of the gifv urls

http://i.imgur.com/vGo06wk.gifv
http://i.imgur.com/QAkHEy6.gifv

but for some reasons, i think its my theme that messing with this.. but if you can take a look to see if its the mod

btw i am single , if you are looking for a husband
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 25, 2016, 10:52:42 AM
Try this one and let me know if m.youtube urls works. Just replace your file on Sources with the attached one.

  Also, do you have some examples of imgur gifv urls to test on?
awesome!!! it works now!

here are an example of the gifv urls

http://i.imgur.com/vGo06wk.gifv
http://i.imgur.com/QAkHEy6.gifv

but for some reasons, i think its my theme that messing with this.. but if you can take a look to see if its the mod

btw i am single , if you are looking for a husband
Spoke too soon. Yes the m.YouTube  works now but it broke the regular YouTube videos
Title: Re: Ohara YouTube Embed
Post by: Suki on October 25, 2016, 11:18:47 AM
can you post examples of the broken urls?

Are you posting simple links our using the youtube tag?
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 25, 2016, 11:27:37 AM
can you post examples of the broken urls?

Are you posting simple links our using the youtube tag?
the url directly
here is an example
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FDwlXH5M.png&hash=6b998a8c7e6bbf79447ecaeef88ba218)
Title: Re: Ohara YouTube Embed
Post by: Suki on October 25, 2016, 01:30:51 PM
Try this one, I made some changes to the way gifv are posted but for some reasons some examples just don't play at all, it returns a 404 code when trying to embed them, must be some config at imgur or something.
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 25, 2016, 02:36:09 PM
Try this one, I made some changes to the way gifv are posted but for some reasons some examples just don't play at all, it returns a 404 code when trying to embed them, must be some config at imgur or something.

awesome! The youtube videos now work!
for the gifv, you are right, its still not working, but at least i am getting an error now instead of nothing . (no worries about the gifv .. its all good. )
thanks for your help
Title: Re: Ohara YouTube Embed
Post by: Suki on October 27, 2016, 09:47:44 AM
A new version has been released:

1.2.8 - Oct 25, 2016
- Improve regex for gifv and youtube urls.
- Pass the ID when using url auto parsing, prevents using another regex to get it.
- Use global scope inside closures..


To upgrade just uninstall any previous version and install the new one and don't forget to check the "Install in Other Themes" checkboxes for all your installed themes.
Title: Re: Ohara YouTube Embed
Post by: lahmfan on October 27, 2016, 11:53:25 AM
A new version has been released:

1.2.8 - Oct 25, 2016
- Improve regex for gifv and youtube urls.
- Pass the ID when using url auto parsing, prevents using another regex to get it.
- Use global scope inside closures..


To upgrade just uninstall any previous version and install the new one and don't forget to check the "Install in Other Themes" checkboxes for all your installed themes.
do i have to do that as well? or that file you gave included those changes?
Title: Re: Ohara YouTube Embed
Post by: Suki on October 27, 2016, 02:27:41 PM
not really, I'm using the same file I attached, do it if you care a bout mod's versions and all that stuff, otherwise no.
Title: Re: Ohara YouTube Embed
Post by: The QE2 Story Forum on October 30, 2016, 10:08:54 AM
A new version has been released:

1.2.8 - Oct 25, 2016
- Improve regex for gifv and youtube urls.
- Pass the ID when using url auto parsing, prevents using another regex to get it.
- Use global scope inside closures..


To upgrade just uninstall any previous version and install the new one and don't forget to check the "Install in Other Themes" checkboxes for all your installed themes.

Thanks!  Upgraded on 2.0.12. with no problems.
Title: Re: Ohara YouTube Embed
Post by: aodio on November 02, 2016, 05:08:33 AM
lovely mate.. Very nice  ;)


cheers
Title: Re: Ohara YouTube Embed
Post by: coltp45 on November 07, 2016, 11:31:18 PM
when I post a video this code appears />

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F1FHJHdK.png&hash=703990b9122416c7982799c52704a9d1)

Im using the last version 1.2.8
Title: Re: Ohara YouTube Embed
Post by: Snek Dankmemes on November 09, 2016, 01:25:30 PM
Gifv doesn't really work on my forum. 1 in 10 might work. The rest just show a black box. And is there a way you can make them just specify the height or width instead of both?
Title: Re: Ohara YouTube Embed
Post by: Suki on November 09, 2016, 04:26:17 PM
There's no real way to fix the imgur gifv,  some of them simply do not play at all,  I don't know if there's a setting to avoid embed on external sites.

I'll look at the height and width
Title: Re: Ohara YouTube Embed
Post by: themavesite on November 10, 2016, 12:32:30 AM
There's no real way to fix the imgur gifv,  some of them simply do not play at all,  I don't know if there's a setting to avoid embed on external sites.

I'll look at the height and width

Yet I managed to fix it months ago. Here's the solution for OharaYTEmbed: gifv part:

Code: [Select]
function OYTE_Gifv($data)
{
global $modSettings, $txt;

loadLanguage('OharaYTEmbed');

// Gotta respect the master setting...
if (empty($data) || empty($modSettings['OYTE_master']))
return sprintf($txt['OYTE_unvalid_link'], 'gifv');

// Set a local var for laziness.
$videoID = '';
$result = '';

// We all love Regex.
$pattern = '/^(?:https?:\/\/)?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.gifv/i';

// First attempt, pure regex.
if (empty($videoID) && preg_match($pattern, $data, $matches))
$videoID = isset($matches[1]) ? $matches[1] : false;


// At this point, all tests had miserably failed.
if (empty($videoID))
return sprintf($txt['OYTE_unvalid_link'], 'gifv');

// Got something!
else
$result = '<video style="max-width: 945px;" autoplay="" loop="" muted="" preload="" class="imgurgifvVid">
<source src="//i.imgur.com/'. $videoID .'.webm" type="video/webm">
<source src="//i.imgur.com/'. $videoID .'.mp4" type="video/mp4">
</video>';

return $result;
}

I believe you only checked for mp4 or webm, but you need to check for both  :)
Title: Re: Ohara YouTube Embed
Post by: Snek Dankmemes on November 10, 2016, 12:35:43 AM
I can verify that that code works. Thanks again!
Title: Re: Ohara YouTube Embed
Post by: Snek Dankmemes on November 10, 2016, 06:40:15 PM
And this works for both Imgur and Gfycat and makes them click to play:

Code: [Select]
/* 2016/11/10
Pulseczar/puzzlecars/Alex O. did this ****** */
function OYTE_Gifv($data)
{
global $modSettings, $txt;

loadLanguage('OharaYTEmbed');

// Gotta respect the master setting...
if (empty($data) || empty($modSettings['OYTE_master']))
return sprintf($txt['OYTE_unvalid_link'], 'gifv');

// Set a local var for laziness.
$videoID = '';
$result = '';
$identifier = '';

// We all love Regex.
$imgurPattern = '/^(?:https?:\/\/)?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.gifv/i';
$gfycatPattern = '/^(?:https?:\/\/)?(?:.+)?(?:gfycat\.com)\/(.+?)(?:\.[^.]*$|$)/i';

// First attempt, pure regex. Imgur
if (empty($videoID) && preg_match($imgurPattern, $data, $matches))
$videoID = isset($matches[1]) ? $matches[1] : false;


if(!empty($videoID))
{

$result = '
<div class="video-container">
<video style="max-width: 945px;" loop="" muted="" preload="" class="imgurgifvVid"
onmousedown="if (!this.controls && event.button == 0) { if (this.paused) { this.play(); } else { this.pause(); }}">
<source src="//i.imgur.com/'. $videoID .'.webm" type="video/webm">
<source src="//i.imgur.com/'. $videoID .'.mp4" type="video/mp4">
</video>
    <div style="font-size: 75%; font-style: italic; padding: 0px; margin: -2px 0px 2px 0px;">Click to Play</div>
</div> ';

return $result;
}

// gfycat
if (empty($identifier) && preg_match($gfycatPattern, $data, $matches))
{
$identifier = isset($matches[1]) ? $matches[1] : false;
}

if(!empty($identifier))
{
$result = '
<div class="video-container">
  <video preload="auto" muted="muted" loop="loop" poster="http://thumbs.gfycat.com/'.$identifier.'-poster.jpg" style="height: auto; max-width: 100%;" onmousedown="if (!this.controls && event.button == 0) { if (this.paused) { this.play(); } else { this.pause(); }}">
<source src="http://zippy.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://zippy.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<source src="http://fat.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://fat.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<source src="http://giant.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://giant.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<a href="http://gfycat.com/'.$identifier.'">[ View Video ]</a>
  </video>
  <div style="font-size: 75%; font-style: italic; padding: 0px; margin: -2px 0px 2px 0px;">Click to Play</div>
</div> ';

return $result;
}


// At this point, all tests had miserably failed.
return sprintf($txt['OYTE_unvalid_link'], 'gifv');

}


It at least works with the [gifv] tag. I haven't tried auto-embed.
Title: Re: Ohara YouTube Embed
Post by: lahmfan on November 13, 2016, 11:32:13 AM
And this works for both Imgur and Gfycat and makes them click to play:

Code: [Select]
/* 2016/11/10
Pulseczar/puzzlecars/Alex O. did this ****** */
function OYTE_Gifv($data)
{
global $modSettings, $txt;

loadLanguage('OharaYTEmbed');

// Gotta respect the master setting...
if (empty($data) || empty($modSettings['OYTE_master']))
return sprintf($txt['OYTE_unvalid_link'], 'gifv');

// Set a local var for laziness.
$videoID = '';
$result = '';
$identifier = '';

// We all love Regex.
$imgurPattern = '/^(?:https?:\/\/)?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.gifv/i';
$gfycatPattern = '/^(?:https?:\/\/)?(?:.+)?(?:gfycat\.com)\/(.+?)(?:\.[^.]*$|$)/i';

// First attempt, pure regex. Imgur
if (empty($videoID) && preg_match($imgurPattern, $data, $matches))
$videoID = isset($matches[1]) ? $matches[1] : false;


if(!empty($videoID))
{

$result = '
<div class="video-container">
<video style="max-width: 945px;" loop="" muted="" preload="" class="imgurgifvVid"
onmousedown="if (!this.controls && event.button == 0) { if (this.paused) { this.play(); } else { this.pause(); }}">
<source src="//i.imgur.com/'. $videoID .'.webm" type="video/webm">
<source src="//i.imgur.com/'. $videoID .'.mp4" type="video/mp4">
</video>
    <div style="font-size: 75%; font-style: italic; padding: 0px; margin: -2px 0px 2px 0px;">Click to Play</div>
</div> ';

return $result;
}

// gfycat
if (empty($identifier) && preg_match($gfycatPattern, $data, $matches))
{
$identifier = isset($matches[1]) ? $matches[1] : false;
}

if(!empty($identifier))
{
$result = '
<div class="video-container">
  <video preload="auto" muted="muted" loop="loop" poster="http://thumbs.gfycat.com/'.$identifier.'-poster.jpg" style="height: auto; max-width: 100%;" onmousedown="if (!this.controls && event.button == 0) { if (this.paused) { this.play(); } else { this.pause(); }}">
<source src="http://zippy.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://zippy.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<source src="http://fat.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://fat.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<source src="http://giant.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://giant.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<a href="http://gfycat.com/'.$identifier.'">[ View Video ]</a>
  </video>
  <div style="font-size: 75%; font-style: italic; padding: 0px; margin: -2px 0px 2px 0px;">Click to Play</div>
</div> ';

return $result;
}


// At this point, all tests had miserably failed.
return sprintf($txt['OYTE_unvalid_link'], 'gifv');

}


It at least works with the [gifv] tag. I haven't tried auto-embed.

this works for me as well. Thanks!
Title: Re: Ohara YouTube Embed
Post by: FragaCampos on November 29, 2016, 11:51:12 AM
Hello there.

The youtube videos in my forum stopped working. It only appears a black square (where the video was supposed to appear) and nothing happens.
Vimeo is working fine.

I've version 1.2.3 but version 1.2.8 seems to show the same behaviour.
Any help, please?
Title: Re: Ohara YouTube Embed
Post by: FragaCampos on November 29, 2016, 05:19:27 PM
Ok, I managed to solve the problem with this suggestion.

You are using another mod which uses jquery with "jQuery" as the variable name, this mod (and SMF 2.1 too) uses "$".

You need to either change the other mod to use $ or replace all instance of $ with jQuery on the Themes/default/scripts/ohyoutube.min.js file file.
Title: Re: Ohara YouTube Embed
Post by: SirLouen on February 01, 2017, 10:56:58 AM
Found a little Issue in the error log
Not sure how is affecting to the forum but here is:
8: Undefined index: youtube
File: /var/www/site/Sources/Subs-Editor.php
Line: 1574

Line 1574 is:
Code: [Select]
'description' => $txt['youtube']
In context:
Code: [Select]
$context['bbc_tags'][] = array(
                        array(
                                'image' => 'youtube',
                                'code' => 'youtube',
                                'before' => '[youtube]',
                                'after' => '[/youtube]',
                                'description' => $txt['youtube']
                        ),
                        array(
                                'image' => 'jwp',
                                'code' => 'jwp',
                                'before' => '[jwp=425,344,image]',
                                'after' => '[/jwp]',
                                'description' => $txt['jwplayer']
                        ),

Any idea?
Title: Re: Ohara YouTube Embed
Post by: Kindred on February 01, 2017, 01:21:08 PM
$txt['youtube'] is not properly defined in your modifications.YOURLANGUAGE.php file
Title: Re: Ohara YouTube Embed
Post by: Suki on February 03, 2017, 09:24:37 AM
This mod does not use that $txt string and it doesn't make any edit to that file. It seems you are using another youtube mod.
Title: Re: Ohara YouTube Embed
Post by: SirLouen on February 03, 2017, 09:57:14 AM
This mod does not use that $txt string and it doesn't make any edit to that file. It seems you are using another youtube mod.

Yep, seems so. Thanks for the response, i was able to solve it
Title: Re: Ohara YouTube Embed
Post by: OCJ on February 22, 2017, 08:41:09 AM
I felt like reporting this mod as unsafe....

Just moved host and did not know the php version was set lower than this mod requires. Perhaps on the package install page there should be a warning that installing on lower php version will crash the SMF installation. And maybe it is possible to show the current php version on the test page and warn (?).

White page.....
 Parse error: syntax error, unexpected T_FUNCTION in /xxxxx/xxxx/public_html/Sources/OharaYTEmbed.php on line 28

This happened twice (moved site files and new installation - package manager backups failed to restore the site).
This happened when I first copied my installation over. I thought perhaps the files were corrupted so started over installing again  from the beginning. It takes time setting themes preferences, mod upload and install.
Then the site broke again after installing this mod.

Simple I thought, just put the mod backup files back and no  problem, Not so. Changed files were replaced with backups but still the same error message and no access to the site.
Only after  changing the htaccess file php version I could get on the site again.

Using package manager backup files - how come when the changed files are replaced with previous versions it still does not work?

Title: Re: Ohara YouTube Embed
Post by: Kindred on February 22, 2017, 08:48:51 AM
Why would that require an unsafe report?  And how is it this mod's fault?  If you are not checking the host for the proper version support before moving, of course it is not going to work...
Title: Re: Ohara YouTube Embed
Post by: OCJ on February 22, 2017, 01:01:20 PM
Most of all - using Backup files in Packages it does not even remove the problem - that is the main point.
After supposedly replacing all changed files with the backups, it still gives errors and a blank page. That is not supposed to happen.
It would be good practice to give a warning during install on the test page that displays if the php version is not new enough and warns that it will render the website unusable and would need server file manager or ftp access to repair it.
Title: Re: Ohara YouTube Embed
Post by: br360 on February 22, 2017, 02:24:34 PM
The minimum PHP version requirements are listed on the main page of the mod-

Quote
Description

For SMF 2.0.x only

Version 1.2.x and above requires PHP 5.3 or greater
Title: Re: Ohara YouTube Embed
Post by: Suki on February 22, 2017, 03:33:35 PM
If you are still unable to access your site, open your DB table using phpmyadmin or a similar tool, go the the settings table and look for the following rows:

integrate_pre_include
integrate_bbc_codes
integrate_bbc_buttons
integrate_general_mod_settings
integrate_load_theme

And remove any string that starts with the prefix: OYTE_

This will completely uninstall the mod.

Please at least try and check the mod's content before filling a report.  The mod does give a warning regarding PHP compatibility:

Quote
if (version_compare(PHP_VERSION, '5.3.0', '<'))
   exit('This mod needs PHP 5.3 or greater. You will not be able to install/use this mod, contact your host and ask for a php upgrade.');


These lines are taken straight from the mod's addHooks.php file. The mod is open source and its content is freely available for everyone to see at: https://github.com/MissAllSunday/OharaYouTubeEmbed/tree/1.2

The minimum required PHP version is visible listed on this mod's readme file too. The readme file is displayed every time you install this mod and it is the user's responsibility to fully read it before installing any mod.

If you have doubts about the mod's version and/or if it will be compatible with X PHP versions you should seek the mod's author for assistant before proceeding with the installation or the PHP version change.

The reason why this check failed during your installation is simple, your PHP version cannot parsed the PHP file because this mod uses new functionality that your PHP version cannot handle. Unfortunately, using closures on PHP versions lower than 5.3 will make PHP crash, theres no solution for this except not using closures.

Your PHP version cannot handle closures, closures are a PHP > 5.3 thing and there is no fallback for previous versions meaning there is absolutely nothing I can do to prevent this beyond adding a minimum required PHP version in the readme as well as a fallback PHP check and I already did those things.

BTW, any mod or any PHP script will have the same problem, even SMF itself. To check for the PHP version requires PHP itself, if PHP crashes, the check cannot be performed.


I did my fair share to tell the users about the minimum requirements and I'm sorry but it is out of the scope of this mod to prevent user related errors. By user related errors I mean users neglecting to read the mod's readme file on install.

Lastly, no. Replacing the files with a backup isn't enough to solve this particular problem, this mod uses hooks which means most of the core functionality of this mod is completely separated from SMF's files. To completely remove the mod, besides replacing your files, the hooks this mod uses needs to be removed from your DB. You can do so by calling the file removeHooks.php via your browser but since you are unable to use PHP you need to do so manually following the instructions I gave previously.

Again, if you require assistant on how to completely remove a mod you should seek the mod's author for help.
Title: Re: Ohara YouTube Embed
Post by: OCJ on February 22, 2017, 06:21:23 PM
Thank you for all the information - I know you do a lot of work on mods here. I was annoyed at Kindreds attitude (as usual). My site is working fine so that not a problem, but I was worried that lurking below the surface was a problem in waiting. With the php version higher it is working but I would guess that if, for whatever reason, it reverted to an older version, The site would go down again.

I assumed mods were all designed so that the  package manager would remove them and leave the forum as it was beforehand. It was quite a shock wen I lost it twice and thought I had followed proper 'proceedures' to revert changes.

In the package manager when installing this mod there is only a 1 line message saying what the minimum php version is (I'm sure people assume that is for the mod to work).
There is no warning that it will make the site inaccesable - even after the files are replaced using backups.



I'm used to fiddling with mods and files and cpanel so its ok. For other people it could cause a lot of trouble - better warning about uninstalling and php version.

Anyway, as you can see from my link the site is fine - thanks again for all the detailed info. I will make the database changes in the near future. It would be worth mentioning this on the install test page of package manager.

Andy
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on February 23, 2017, 11:21:55 AM
Thank you for all the information - I know you do a lot of work on mods here. I was annoyed at Kindreds attitude (as usual).
;D

Btw, in a very polite way, I think what igirisjin wants to say is that the warning should be:
"This mod requires php 5.3 version or greater, otherwise it may not only fail, but also make your forum unusable."
Or something similar :)

I'm pretty sure you realize that the meaning of the sentence as it is can be easily interpreted as "The mod will fail with php<5.3", which is different from "It will break everything if php<5.3" ;)

Not criticizing the code, that one seems to be fine (and you detailed it pretty well), but the warning could really use an improvement for clarity.
Title: Re: Ohara YouTube Embed
Post by: Suki on February 24, 2017, 11:23:19 AM
Sorry but no. It is an statement, not a warning, as such, it requires no further improvements.

Why are you guys making such a fuss out of this?  this whole thing could have been easily avoided by ASKING first. As simple as that. Something like: "Hey, I didn't understood your minimum PHP version statement, can I install this mod on PHP x.x?"

Or how about this one: "I'm changing my PHP version to x, can this mod will work on it?".

Thats it. Thats all you guys needed to do. ASK.

You made a mistake. Plain and simple. What you guys need to do is learn from it to avoid doing it again instead of trying to blame the mod or try to find loopholes in the description.

Lastly, you guys should really, really read the mod's license, specially this bit:  https://github.com/MissAllSunday/OharaYouTubeEmbed/blob/1.2/License#L263
Title: Re: Ohara YouTube Embed
Post by: Arantor on February 24, 2017, 12:13:56 PM
Considering that PHP 5.3 came out in 2009 and stopped receiving any kind of support from the PHP dev team in 2014, the only unsafe thing around here is the hosting company.
Title: Re: Ohara YouTube Embed
Post by: shawnb61 on February 24, 2017, 01:14:57 PM
I don't think anyone knew in advance what would happen under these exact circumstances.  I would never have guessed the site might come down if you ignored the warning.

I'm not sure it's reasonable to expect every mod developer to test vs every ancient version to know all potential impacts.   
Title: Re: Ohara YouTube Embed
Post by: Arantor on February 24, 2017, 02:35:13 PM
What's to test? It flat out will break because everything about this mod relies on features that only exist in PHP 5.3 and up.

Since the only way to install the mod is to go through the hook file, and the hook file tests that you're on 5.3+, how do you end up breaking your installation except by choosing to ignore a warning that was put there for a good reason?
Title: Re: Ohara YouTube Embed
Post by: Illori on February 24, 2017, 02:37:56 PM
how do you end up breaking your installation except by choosing to ignore a warning that was put there for a good reason?

changing hosts, moving to one with a lower php version and just move your files/database over to the new host where you dont need to run the installer as it was already run before the files were copied over.
Title: Re: Ohara YouTube Embed
Post by: Arantor on February 24, 2017, 02:38:36 PM
How do you end up with a host that has a version of PHP that is nearly 10 years old?
Title: Re: Ohara YouTube Embed
Post by: shawnb61 on February 24, 2017, 04:00:08 PM
I bet they're like my host:  default to an old version, but upgrading is at your discretion.   I bet a scan thru cpanel would be in order.
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on February 25, 2017, 01:52:07 AM
How do you end up with a host that has a version of PHP that is nearly 10 years old?
Possibly most of them, if not all, considering people can't be bothered to follow php insane development speeds, having to rewrite their softwares every 2 years. If you are, smf 2.1 is on GitHub, feel free to go ahead and recode it to be php 7.0+ compatible :) (and no don't ask me to do so myself, I couldn't, whereas you could).

The answers got me laughing though, thanks for that ;D

@shawnb61 exactly. The one time I got defaulted to php 7.0 while moving a forum it took me a while to figure out why repair settings was acting as if it were smf 1.1 instead of 2.0 :P
Title: Re: Ohara YouTube Embed
Post by: Arantor on February 25, 2017, 04:20:15 AM
Quote
follow php insane development speeds, having to rewrite their softwares every 2 years.

Sorry, but that's BS.

5.3 had very few backwards incompatible issues and debuted in 2009. We're now 8 years on from that.

In fact, let me give you some history. 5.0 debuted in July 2004. 5.3 debuted in 2009. SMF 2.0 final was 2011. And a lot of time was spent during 2010 and 2011 making sure that SMF worked on older versions because we knew at the time that hosts weren't upgrading. We knew that even though PHP 4.4 was end of life in 2007, hosts were still using it.

In this case we're talking about PHP 5.2, a version that came out the same year SMF 1.1.0 did, in 2006. It stopped receiving support in 2011, the same year SMF 2.0.0 came out. We're now in 2017, and hosts are still using 5.2, even though there is virtually no pain in upgrading? (Unlike 4.x to 5.x where there can be significant pain)

This isn't insane. This is reasonable, because you can't manage infinite versions of things even with a team the size of the core PHP dev team.

There are notable changes in 5.3, 5.4, 5.5 and 7.0 that could have but did not significantly affect SMF users.

5.3's introduction of closures is a big deal in terms of programming. Fun fact: SMF is going to have to move to 5.3+ at some point (2.1 already has) because proposed changes for PHP 7.2 will force it to redo how bbcodes work under the hood because closures are a good thing and replace the old lambda function generator which was a hack from the start.

Mods that want to take advantage of this should do - it's been around for 8 years, and heck, even 5.3 isn't supported any more.

5.4 introduced lazy array syntax, so that instead of writing array(1, 2, 3), you could just write [1, 2, 3] which is a good thing. But it will break if you try to use it before PHP 5.4. Good news, PHP 5.4 has been around since 2012 and stopped being supported in 2015, so it's already outside of its end of life phase.

5.5 introduced a number of changes that are all about making PHP better internally, and they do so by phasing out things that shouldn't be used, like the preg-replace thing. It was something that should never have been introduced in the first place, it was far too easy to do something stupid with. And SMF adapted because it had to, which is the correct thing. (When SMF first wrote that code, the 5.5 way didn't exist.)

7's changes, everyone is moaning about them but I doubt anyone understands why the MySQL thing is a thing. It's about making trips to the database faster and use less memory. And it was set up by earlier versions of PHP, too. Because they didn't just remove it from PHP without any warning. We knew in advance what they were going to do because in 5.6 it issues warnings to you that the feature is going away.

But 'recoding' every couple of years? Only if you're doing it wrong. Using techniques that have been around for 5-8 years isn't a problem, the only problem are the hosts running known-insecure versions of PHP on their servers.
Title: Re: Ohara YouTube Embed
Post by: shawnb61 on February 25, 2017, 10:40:03 AM
Most admins don't know to look...   

I consider myself reasonably savvy, and I only looked when I couldn't get a mod to work.   Early 2016 and we were defaulting to 5.2! 

I found an applet on cpanel, and changed it.   I bet many folks similarly have it under their control, and just don't know it...
Title: Re: Ohara YouTube Embed
Post by: OCJ on February 25, 2017, 12:54:30 PM
Bluehost .... and Im sure I saw it advertised here on SMF (though it could've been a google ad). Other cheap hosts are doing the same.
As the club members would prefer to pay absolutely 0 - nothing, but expect their own website and tons of features, I have no choice but to use cheap hosting.

Title: Re: Ohara YouTube Embed
Post by: Arantor on February 25, 2017, 01:03:37 PM
Bluehost support modern versions of PHP just fine - their knowledge base says they support everything from 5.4 to 7, all of which cover this case off.

Still not sure where the problem is.

Oh, and if PHP 5.3 is a problem, don't upgrade to SMF 2.1, that has a minimum of 5.3.8.
Title: Re: Ohara YouTube Embed
Post by: OCJ on February 26, 2017, 11:47:06 AM
Well, as soon as I changed the php version in the htaccess file to the required version, the problem went away. Nothing else was changed.
I remember last year I had similar trouble on ipage cheapest hosting plans (other software). I didn't expect it on Bluehost but it happened.

Just to confirm that, I just ran a php check from the browser.

Current PHP version: 5.4.43 (set to 5.4 in htaccess file)

Renamed htaccess file, cleaned the cache and ran the script again....

Current PHP version: 5.2.17

Thats Bluehost.

Title: Re: Ohara YouTube Embed
Post by: Suki on March 12, 2017, 02:58:07 PM
A new version has been released:

1.2.9 - March 12, 2017
- Fix the "/>" appearing on autoembed
- Fix support for gifv
- Add a link to the video if JavaScript is disabled


To upgrade just uninstall any previous version and install the new one and don't forget to check the "Install in Other Themes" checkboxes for all your installed themes.
Title: Re: Ohara YouTube Embed
Post by: kaesekopf on March 23, 2017, 04:16:23 AM
Howdy!
This mod is great, and I've found it's very popular at my forum.

However, is there a way to embed the text/title of the video on the embedded screenshot (before someone hits play)?

Example screenshot of current YouTube display:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FXH8lNDA.png&hash=ae0c342a7be4f3be5460d1564f718a9f)

Desired screenshot:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F8i2x9iY.png&hash=372838002237ab17570f3c2999af1944)

ETA:  Is this the jQuery issue you mentioned back in 2015 (http://www.simplemachines.org/community/index.php?topic=462968.msg3821245#msg3821245)? 
Title: Re: Ohara YouTube Embed
Post by: Suki on March 25, 2017, 11:30:59 AM
It has been requested before and I added it to this mod version for SMF 2.1 heres an example of how it would look (https://missallsunday.com/re-qu%C3%A9-tema-de-m%C3%BAsica-est%C3%A1s-escuchando-11/page/56#msg4851), not the same forum engine but I used the same code this mod uses so the result is the same. Unfortunately, I forgot why exactly I didn't backport it to version 1.2.x which is the one compatible with SMF 2.0.x

I don't know what you mean by

Quote
ETA:  Is this the jQuery issue you mentioned back in 2015?

Th jquery $ issue has nothing to do with been able to show the video's title.
Title: Re: Ohara YouTube Embed
Post by: MULITRI on March 25, 2017, 05:58:17 PM
Hello,

I really loved this Mod, and installed it without any problem, however i had the same problem that the user luckse asked to be solved,

http://www.simplemachines.org/community/index.php?topic=462968.msg3879825#msg3879825

But after read the whole topic, it seems the solution was not posted and his question lost.

Unfortunately i had to uninstall it, but i will be in touch with this thread in the case one day could be solved.

Thanks for your work... Regards.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 25, 2017, 06:24:05 PM
I can't fix something I cannot reproduce. I asked for more details and got no response.
Title: Re: Ohara YouTube Embed
Post by: Doug Spinster on March 27, 2017, 11:37:11 AM
I am not sure where to put the files from the download. I am using Go Daddy. Sorry about being a newb, I am not much of a coder. I do understand some things.

Thanks
Title: Re: Ohara YouTube Embed
Post by: FragaCampos on March 28, 2017, 08:42:29 PM
Just use the admin panel's package manager. It's very simple.
More info here:
http://wiki.simplemachines.org/smf/SMF2.0:Package_manager


I am not sure where to put the files from the download. I am using Go Daddy. Sorry about being a newb, I am not much of a coder. I do understand some things.

Thanks
Title: Re: Ohara YouTube Embed
Post by: jsx on May 16, 2017, 05:44:56 AM
I’m lacking the option in this modification, thanks to which it is possible to set place of film because originally is imposed showing film in the middle.

I’m lacking in this modification showing the title right on the top of film before turn it on. Such like this is in the Yet Another YouTube BBCode Tag modification.

I’m lacking the option, thanks to which it is possible to turn off the vimeo and imgur tag. Should be choice.

I think that taking the example from the other modification isn't bad.

Is there a chance of adding these suggestions to the modification?
Title: Re: Ohara YouTube Embed
Post by: Steve on May 16, 2017, 09:02:56 AM
What's the point of making two mods do the same things?
Title: Re: Ohara YouTube Embed
Post by: Gluz on May 16, 2017, 04:51:18 PM
I’m lacking the option in this modification, thanks to which it is possible to set place of film because originally is imposed showing film in the middle.
That can be done adding in your index.css:
Code: [Select]
.oharaEmbed{
    display: inline-block;
}
Then, it will behave like any text, and you can add the alignment BBCodes to put the video in the left, center or right side.

I’m lacking the option, thanks to which it is possible to turn off the vimeo and imgur tag. Should be choice.
That is in the Admin Panel > Post Settings > BBC. Here you can choose what BBCodes to turn OFF.

I’m lacking in this modification showing the title right on the top of film before turn it on. Such like this is in the Yet Another YouTube BBCode Tag modification.

I think that taking the example from the other modification isn't bad.
I can argue that I installed this because that other MODs didn't do the thing well for me, so having this doing the same as the others means that will cause that this MOD also didn't work well (aesthetically) for me. The variety of doing the same but not looking exactly the same is why some MODs are similar but still each one have different uses.
Title: Re: Ohara YouTube Embed
Post by: jsx on May 17, 2017, 04:38:53 PM
What's the point of making two mods do the same things?

These two modification are interesting but each of them is lacking these functions which I listed. I could use the one or this modification, choose some of them, but unfortunately each of them is lacking what I expect.

@Gluz

Thanks for information.
Title: Re: Ohara YouTube Embed
Post by: waltari on July 16, 2017, 10:51:32 AM
Hello, first of i would like to thank you for this great mod. Installed it recently and encoutered a weird graphical glitch in Google Chrome, iam attaching screenshots to demostrate it. Its basically this, if i put a Youtube link in the post all is fine, but when i click the play button, weird lines appear all across the active containers (category and the post itself), header, footer and menu stays untouched. again this is a bug present ONLY in Google Chrome.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fpics.webillusion.cz%2Fohr_normal.jpg&hash=96098c9d05274dbe13129a07e2a27124)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fpics.webillusion.cz%2Fohr_running.jpg&hash=0e18b0a6e3b1c53c2835935ebe8b7c16)
Title: Re: Ohara YouTube Embed
Post by: Suki on July 18, 2017, 11:31:50 AM
Do you have a link to a topic where this happens?
Title: Re: Ohara YouTube Embed
Post by: waltari on July 27, 2017, 01:14:09 PM
Do you have a link to a topic where this happens?

http://forum.capsuleer.cz/index.php?topic=10.0
Title: Re: Ohara YouTube Embed
Post by: Ninja ZX-10RR on July 27, 2017, 10:50:24 PM
You may want to update your Chrome or something, it's fine here.
Title: Re: Ohara YouTube Embed
Post by: waltari on July 28, 2017, 09:02:38 AM
You may want to update your Chrome or something, it's fine here.

mine is 59.0.3071.115 64bit which seems to be latest release, same on my laptop. The "bug" is visible on both, its not present on my mobile chrome though, ill try to fiddle with my desktop chrome and its extension and try to fix this, thanks.

edit: version 60.0.3112.78 just poped up as a update, the problem persist though :(
Title: Re: Ohara YouTube Embed
Post by: Suki on July 29, 2017, 11:14:03 AM
I cannot reproduce the issue, does this happens on the default theme too?
Title: Re: Ohara YouTube Embed
Post by: jsx on August 25, 2017, 09:26:41 AM
@Suki

How in Ohara YouTube Embed modification set showing video from left side? In file (...)default/css/oharaEmbed.css is such a code:

Code: [Select]
.oharaEmbed {
margin-left: auto ;
margin-right: auto ;
text-align:center;
background-position: center;
background-repeat: no-repeat;
background-color: #000;
overflow: hidden;
transition: all 200ms ease-out;
cursor: pointer;
}


And into this code need to paste this code?

Code: [Select]
display: inline-block;
It's the correct solution?

And perhaps in the next version you would implement the option of setting the position video? Left, centre.
Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2017, 12:01:07 PM
Remove this bit:

margin-left: auto;

There used to be a setting to set the position, it wasn't used at all so it was removed.
Title: Re: Ohara YouTube Embed
Post by: jsx on August 25, 2017, 01:13:10 PM
Thanks for information but will you minded to introduce the function of setting the position of the video in the management with this modification in the panel of the admin?
Title: Re: Ohara YouTube Embed
Post by: Suki on August 25, 2017, 04:01:28 PM
Thing is, defining a UI option from the backend really isn't the way to go, specially if an user is using different themes  or decides to change themes, etc.  A far more modular approach would be to define a new css rule for each theme you have if you want to change the default behaviour.

But if enough people request it then I will add it back.
Title: Re: Ohara YouTube Embed
Post by: jsx on August 27, 2017, 02:20:44 PM
I understand, I'm doubting that somebody will ask for it, in my opinion such a function is useful in managing this modification.
Title: Re: Ohara YouTube Embed
Post by: YogiBear on September 08, 2017, 09:11:03 AM
I have just discovered this mod. Auto-embedding? I haven't had such luxury since Aeva, A nice, simple to use, does what it says mod. Big Thankyou, Suki.   :) :)
Title: Re: Ohara YouTube Embed
Post by: Suki on September 09, 2017, 02:09:08 PM
"Thank you"  ???  I'm afraid I'm unfamiliar with those words  :P

Nah, cool you like it.
Title: Re: Ohara YouTube Embed
Post by: rad1701 on September 24, 2017, 02:06:38 PM
Any idea why this is going on or how to fix it before I try to install....

Execute Code   addHooks.php   
*   2.   Execute Modification   ./Sources/Post.php   Test failed
   1.   Replace   ./Sources/Post.php   Test failed
   2.   Replace   ./Sources/Post.php   Test failed
Title: Re: Ohara YouTube Embed
Post by: Suki on September 24, 2017, 03:08:48 PM
When you click on the failed line it opens a new window indicating the modifications the mod is trying to do.

A failed test usually means some other mod has already modified the part this mod is trying to modify.

You can manually edit that file and keep on installing the mod after that. The test filaed will still appear but you already modified the file.

If you are unsure or don't know how to modify files, attach your Sources/Post.php file here.
Title: Re: Ohara YouTube Embed
Post by: rad1701 on September 24, 2017, 03:17:56 PM
Ok - looks like it's telling me this...

Code: (Find) [Select]
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '') === false))
Code: (Replace) [Select]
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><iframe><video><div>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '') === false))
Title: Re: Ohara YouTube Embed
Post by: Suki on September 24, 2017, 03:34:57 PM
If you take a closer look you will see the mod is trying to add the following tags: <iframe><video><div>

So all you have to do is adding those tags after the img tag.
Title: Re: Ohara YouTube Embed
Post by: Steve on September 24, 2017, 04:28:06 PM
Quick off-topic comment ... glad to see you're okay Suki.
Title: Re: Ohara YouTube Embed
Post by: Suki on September 25, 2017, 11:31:45 AM
Thank you and also thanks to everyone else who expressed their concerns.
Title: Re: Ohara YouTube Embed
Post by: jsx on February 15, 2018, 05:36:50 AM
@Suki

Why does the centered link not display the embedded video in this way? The embedded video is not displayed. Such a solution doesn't work.

Code: [Select]
[center]https://www.youtube.com/watch?v=ehjJ614QfeM[/center]
Title: Re: Ohara YouTube Embed
Post by: Kindred on February 15, 2018, 10:29:45 AM
I would assume, because it is inside another BBC, the autoparser doesn't pick it up
Title: Re: Ohara YouTube Embed
Post by: Suki on February 15, 2018, 11:59:44 AM
Yes and it is by design. IF you want to put youtube urls inside any BBC tags, use the youtube tag.  I believe by default the mod centers the videos already and if not, the mod provides a custom class that you can use to make all videos centered thus avoiding the need to use bbc tags.
Title: Re: Ohara YouTube Embed
Post by: jsx on February 16, 2018, 04:36:12 AM
I thank for information.

In this post (https://www.simplemachines.org/community/index.php?topic=462968.msg3939720#msg3939720) I asked how to remove video centring and it suits me, but I want to centre only one video. Unfortunately, this combination does not work.

Code: [Select]
[center][youtube]https://www.youtube.com/watch?v=ehjJ614QfeM[/youtube][/center]
Title: Re: Ohara YouTube Embed
Post by: Suki on February 18, 2018, 01:57:48 PM
Thats because the css that controls the videos is loaded after the css applied to the center tag.  You could create a custom BBC for centering and then add its css on this mod's css file at the end but its honestly a lot of work just to center one single video.
Title: Re: Ohara YouTube Embed
Post by: Xpresskonami on February 19, 2018, 10:41:44 AM
This mod is working well for me but the problem is I set the Width to be "450" and height is "320" but it only look good on desktop not Auto fit on mobile. and also it as no Autofullscreen please how can I make the mod .. responsive on mobile and on desktop view ..
Title: Re: Ohara YouTube Embed
Post by: Suki on February 21, 2018, 11:24:25 AM
Do you have a link with an example of this behavior?
Title: Re: Ohara YouTube Embed
Post by: becometa on February 26, 2018, 09:10:20 AM
Great mod!
GIFV embeeding works as expected however youtube is being embedeed but playback button does nothing.

Example (last post) https://kryptowaluty.org.pl/sprawy-techniczne-i-opinie/dziennik-zmian/?message=253
Title: Re: Ohara YouTube Embed
Post by: Suki on February 26, 2018, 05:56:15 PM
I can click the video just fine as a guest using Vivaldi 1.14.

The mod largely depends on JS to render the videos, it might be the case that some js are only rendered for registered suers and that theres an error on that js, preventing this mod from showing the videos correctly.

Try loading that page as a guest and see if theres any difference.
Title: Re: Ohara YouTube Embed
Post by: becometa on February 27, 2018, 05:21:04 AM
I can click the video just fine as a guest using Vivaldi 1.14.

The mod largely depends on JS to render the videos, it might be the case that some js are only rendered for registered suers and that theres an error on that js, preventing this mod from showing the videos correctly.

Try loading that page as a guest and see if theres any difference.

I've tried to play the video using:
- Chrome ver. 64.0.3282.167 64bit (both incognito as guest and normal as logged user)
- Firefox Dev ver. 59.0b12 (64-bit) (same as above)
- Opera ver. 50.0.2762.67 (same as above)

I've also installed Vivaldi ver. 1.14.1077.50 out of curiosity what might it look like ;) and unfortunately none of them played the video for me.

@edit

I've checked it on the second computer using Chrome as a guest and it acts the same - nothing happens.
However, Chrome browser on Android (smartphone) actually worked but with big black border on bottom of the video frame.
Title: Re: Ohara YouTube Embed
Post by: Suki on February 27, 2018, 10:55:10 AM
Can you open chrome dev tools and see if theres any js error showing when displaying a page with a video on it?
Title: Re: Ohara YouTube Embed
Post by: becometa on February 28, 2018, 05:29:15 AM
Can you open chrome dev tools and see if theres any js error showing when displaying a page with a video on it?

(https://i.imgur.com/3zQ7kRI.jpg)
this is being displayed in console after clicking the play button

Code: [Select]
ohyoutube.min.js:8 Uncaught TypeError: $ is not a function
    at HTMLDivElement.<anonymous> (ohyoutube.min.js:8)
    at HTMLDivElement.d (jquery.min.js:3)
    at HTMLDivElement.dispatch (jquery.min.js:3)
    at HTMLDivElement.r.handle (jquery.min.js:3)

It is conflicted with other mod using JS/jQuery?
Title: Re: Ohara YouTube Embed
Post by: Suki on February 28, 2018, 11:06:09 AM
Yes, most likely theres another mod adding/using jquery, you will need to list all the mods that are using it and remove them one by one to know which one is causing the conflict.
Title: Re: Ohara YouTube Embed
Post by: becometa on March 15, 2018, 06:12:52 AM
Yes, most likely theres another mod adding/using jquery, you will need to list all the mods that are using it and remove them one by one to know which one is causing the conflict.

I've found the conflicting one. It's one of the mods made by SMFPacks called Super Quotes.
Mod author is informed about the issue and is working on it.

Thank you for your time!
Title: Re: Ohara YouTube Embed
Post by: Suki on March 15, 2018, 12:34:19 PM
Cool. Usually on cases like this the mod author checks if jquery is already loaded and only adds the library if it isn't, that greatly helps to avoid conflicts with other mods also using jquery.

SMF 2.1 solves this by using jquery by default.
Title: Re: Ohara YouTube Embed
Post by: njtweb on May 28, 2018, 01:49:29 PM
Any way to edit the BBCode to make the video scale based on the device it's being viewed on? Looks great on a computer or tablet but on a phone it stays the same size and doesn't scale down even with default curve theme and responsive curve mod installed.

Link to post
Code: [Select]
https://www.youthhockeyinfo.com/index.php/topic,335.html
Title: Re: Ohara YouTube Embed
Post by: njtweb on May 29, 2018, 08:03:41 AM
Hmm, weird. I deleted this ^^^ Yesterday. Not sure why it's showing up again but the issue is sorted.
Title: Re: Ohara YouTube Embed
Post by: Sir Osis of Liver on July 23, 2018, 11:19:15 PM
Just trying this on test forum, 2.0.15 Curve.  Video loads, but click play button it scrolls up and get black screen.  Video plays normally on youtube.  Showing this code -

Code: [Select]

<iframe src="//www.youtube.com/embed/FIeSFyV2tsI?autoplay=1&amp;autohide=1" frameborder="0" allowfullscreen="allowfullscreen" style="width: 480px; height: 270px;"></iframe>


You can see it here (http://www.thekrashsite.com/smf20/index.php?topic=29.msg176#msg176)
Title: Re: Ohara YouTube Embed
Post by: njtweb on July 24, 2018, 01:14:01 AM
Works fine for me in Chrome
Title: Re: Ohara YouTube Embed
Post by: lurkalot on July 24, 2018, 03:03:22 AM
Works fine for me in Chrome, IE11, Edge, Firefox.  Did have a moment in Chrome where after I clicked play it scrolled but took a few seconds to load anything.  Apart from that it seems fine.
Title: Re: Ohara YouTube Embed
Post by: Suki on July 24, 2018, 01:08:01 PM
Just trying this on test forum, 2.0.15 Curve.  Video loads, but click play button it scrolls up and get black screen.  Video plays normally on youtube.  Showing this code -

Code: [Select]

<iframe src="//www.youtube.com/embed/FIeSFyV2tsI?autoplay=1&amp;autohide=1" frameborder="0" allowfullscreen="allowfullscreen" style="width: 480px; height: 270px;"></iframe>


You can see it here (http://www.thekrashsite.com/smf20/index.php?topic=29.msg176#msg176)


This is most likely a JS issue, unfortunately, in order to avoid using iframes directly on the server side I rely on JS to create the video code on demand. This means the mod relies on the browser correctly handling whatever JS the page needs to run. THere might be cases where the browser doesn't parse/run JS and the mod will not work correctly.
Title: Re: Ohara YouTube Embed
Post by: Sir Osis of Liver on July 24, 2018, 04:53:31 PM
Works in FF60, not in IE11.  I'm running other code that uses iframe with js (not video), haven't had any problems in IE.  Any ideas for a fix?
Title: Re: Ohara YouTube Embed
Post by: Suki on July 24, 2018, 05:06:47 PM
will need to take a look at the console log for IE11 and if you have any other js running alongside this one.
Title: Re: Ohara YouTube Embed
Post by: Sir Osis of Liver on July 24, 2018, 05:54:45 PM
This is a clean install, no additional js is running.  What to look for in console log?  Most of the working parts seem to be in ohyoutube.js, but I'm not seeing where/how it runs video after play button is clicked. 
Title: Re: Ohara YouTube Embed
Post by: Sir Osis of Liver on July 25, 2018, 12:23:02 PM
Found the problem, Suki, it's not in your mod.  IE tracking protection blocks video from playing.  Apparently it doesn't see the trackers when video loads, only when it plays.  I use it for ad blocker, but I doubt many IE users even know it's there.  Odd that it doesn't block same video at youtube.com, just in forum.

Title: Re: Ohara YouTube Embed
Post by: Suki on July 25, 2018, 02:38:11 PM
Cool. Also worth to mention that things like noscript or other stuff that prevents JS execution will prevent this mod from working.

As for working on youtube.com probably because they have some kind of agreement, google likes to do that a lot to favor their own products.
Title: Re: Ohara YouTube Embed
Post by: dowhelp on July 27, 2018, 06:47:11 AM
Hi Suki

I have Ohara installed but would like the functionality of facebook videos etc.

I had SAVE mod installed. When I installed your mod as well it gave the error :

Code: (Find) [Select]
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '') === false))
Code: (Replace) [Select]
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><iframe><video><div>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '') === false))


Just like rad1701. I clicked on the "failed line.
Pressed "select" on the "replace".
The error still shows.
Is it ok to continue?

Will it interfere with SAVE (if you know)?

Will an uninstall of the mod remove it and the modification to the code?

Thank you for any help you can give.

Regards

Title: Re: Ohara YouTube Embed
Post by: Kindred on July 27, 2018, 07:04:12 AM
that indicator is telling you what you have to MANUALLY change.

pressing "select" just selects it in the browser window.
https://wiki.simplemachines.org/smf/Error_in_mod_installation
Title: Re: Ohara YouTube Embed
Post by: dowhelp on July 27, 2018, 12:10:40 PM
Thank you kindred
Title: Re: Ohara YouTube Embed
Post by: melanie1986 on October 04, 2018, 01:39:38 AM
 Would it be possible at all to modify this mod to playback Dailymotion videos on my site?
Title: Re: Ohara YouTube Embed
Post by: FishingManMatt on October 11, 2018, 05:34:03 PM
Hi!

Just wanted to let you know that the language PHP files do not end with ?>

Regards,
Matt
Title: Re: Ohara YouTube Embed
Post by: Kindred on October 11, 2018, 06:03:00 PM
they don't have to...
Title: Re: Ohara YouTube Embed
Post by: FishingManMatt on October 13, 2018, 08:04:50 AM
Ah, OK.
I thought it was some kind of a typo.
Thanks for the reply :)
Title: Re: Ohara YouTube Embed
Post by: FishingManMatt on November 02, 2018, 09:20:01 AM
Let me report that the W3C validator shows warnings (see attached screenie) which are probably related to
line 659 in OharaYTEmbed.php
Code: [Select]
<script type="text/javascript">!window.jQuery && document.write(unescape(\'%3Cscript src="//code.jquery.com/jquery-1.9.1.min.js"%3E%3C/script%3E\'))</script>
Title: Re: Ohara YouTube Embed
Post by: njtweb on November 02, 2018, 11:23:04 AM
Would it be possible at all to modify this mod to playback Dailymotion videos on my site?

Use this instead if you want Daily motion support. https://custom.simplemachines.org/mods/index.php?mod=2681
Title: Re: Ohara YouTube Embed
Post by: Suki on November 05, 2018, 07:13:54 AM
Let me report that the W3C validator shows warnings (see attached screenie) which are probably related to
line 659 in OharaYTEmbed.php
Code: [Select]
<script type="text/javascript">!window.jQuery && document.write(unescape(\'%3Cscript src="//code.jquery.com/jquery-1.9.1.min.js"%3E%3C/script%3E\'))</script>

Yeah I'm aware of those, its a false alarm. The W3C parser isn't particulary smart about handling JS.
Title: Re: Ohara YouTube Embed
Post by: Argon3000 on November 27, 2018, 01:14:47 PM

For SMF 2.0.x only

Version 1.2.x and above requires PHP 5.3 or greater

Hello!

SMF 2.0.15 + Ohara YouTube Embed 1.2.9 on PHP 5.6 mod work.

PHP 7.0 mod does not work. On-screen text Youtube: "An error occurred. Please try again later (playback ID=...)"

Please, help?





Title: Re: Ohara YouTube Embed
Post by: jsx on December 02, 2018, 05:36:57 AM
Suki,

I added translation file for Polish. Please, put it in your modification.

Title: Re: Ohara YouTube Embed
Post by: FishingManMatt on December 06, 2018, 01:52:11 PM
Thanks for your translation, jsx.
Damn! I also made my Polish translation and completely forgot to send it to Suki. Now you've reminded me about that. I always sent my translations to authors via PM.
So here it is... Now you have two Polish translations  ;D

Cheers!
Title: Re: Ohara YouTube Embed
Post by: jsx on December 17, 2018, 08:14:12 AM
I was first with this translation. :)
Title: Re: Ohara YouTube Embed
Post by: Suki on December 22, 2018, 03:07:49 PM

For SMF 2.0.x only

Version 1.2.x and above requires PHP 5.3 or greater

Hello!

SMF 2.0.15 + Ohara YouTube Embed 1.2.9 on PHP 5.6 mod work.

PHP 7.0 mod does not work. On-screen text Youtube: "An error occurred. Please try again later (playback ID=...)"

Please, help?




JUst did a test on PHP 7.1.17 and the mod worked just fine. Since it relies heavily on js I suspect you have some js conflict somewhere.
Title: Re: Ohara YouTube Embed
Post by: Suki on December 25, 2018, 01:37:10 PM
@jsx and @FishingManMatt thank you for your translations, can you also provide a non-utf8 file?
Title: Re: Ohara YouTube Embed
Post by: jsx on March 08, 2019, 09:15:02 AM
@jsx and @FishingManMatt thank you for your translations, can you also provide a non-utf8 file?

@Suki

I attached two language files. The translation have been revised, so please download these new files and please put this translation in your modification.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 10, 2019, 11:49:08 AM
Hi jsx, your OharaYTEmbed.polish.php file looks kinda weird. For it to be valid, it needs to be encoded in the same encoding the Polish translation uses, right now, notepad++ detects the file as just "ANSI". This means that any special character won't be displayed correctly for users that aren't using the UTF8 Polish language.

According to wikipedia, Polish uses Windows-1250 so thats the encoding I'm going to use for that file and hope nothing gets too borked.
Title: Re: Ohara YouTube Embed
Post by: Suki on March 10, 2019, 12:20:20 PM
New version:

1.2.10 - March 10, 2019
- Add Polish translation, thanks to jsx and FishingManMatt
- Correctly delete language files on uninstall
- Spanish word corrections
Title: Re: Ohara YouTube Embed
Post by: jsx on March 10, 2019, 04:35:59 PM
Hi jsx, your OharaYTEmbed.polish.php file looks kinda weird. For it to be valid, it needs to be encoded in the same encoding the Polish translation uses, right now, notepad++ detects the file as just "ANSI". This means that any special character won't be displayed correctly for users that aren't using the UTF8 Polish language.

According to wikipedia, Polish uses Windows-1250 so thats the encoding I'm going to use for that file and hope nothing gets too borked.

Hi,

OharaYTEmbed.polish.php file has ANSI coding set in Notepad++ that correctly displays the Polish language in translation SMF ISO-8859-2 (http://www.smf.pl/index.php?action=tpmod;dl=item6) also called (ISO Latin-2). You can download the translation with the ISO-8859-2 coding from the link and you can check that the same character encoding is set. If ANSI coding can not be set, it's ok. I did not know about it.

File provided by me OharaYTEmbed.polish.php has:

(https://i.imgur.com/knZNpqu.png)

It indicates Notepad++

ISO-8859-2: These code values can be used for the following languages:

Albanian
Bosnian
Croatian
Czech
German (fully compatible with ISO/IEC 8859-1 for German texts)
Hungarian
Polish
Serbian Latin
Slovak
Slovene
Upper Sorbian
Lower Sorbian
Turkmen

https://en.wikipedia.org/wiki/ISO/IEC_8859-2

So the Polish language uses the Central European coding Windows-1250 (1252) and Eastern European ISO-8859-2.
Title: Re: Ohara YouTube Embed
Post by: Arantor on March 10, 2019, 04:40:07 PM
If only Win-1252 and ISO-8859-2 were actually the same thing; they're not. I don't *think* the differences matter for your file unless you involved MS Office products in the creation, but they're NOT the same.
Title: Re: Ohara YouTube Embed
Post by: Bitman1er on April 13, 2019, 03:26:21 PM
Hi suki

I just installed your mod on my 2.0.15 forum, no error so far, but no youtube embeded, with ou without tag

I have nothing on admin panel about the mod

and if I want to delete it I have this

http://condylure.info/upload/data/suki.jpg

Any advice ? I m blocked

thanks
Title: Re: Ohara YouTube Embed
Post by: Suki on April 13, 2019, 06:58:20 PM
It looks like the file edits weren't performed when the mod was installed so they fail on uninstall.

If you click in the little page with pencil icon you could see w hich line the packager manager is trying to remove, check if your file has that line, if it doesn't for all the file edits then you can safely remove the mod.
Title: Re: Ohara YouTube Embed
Post by: Bitman1er on April 14, 2019, 08:20:00 AM
ok, I saw no diff with original files, the mod did nothing so I deleted it :D

I reinstall it, it seems to work now !

thanx a lot, good job ;)
Title: Re: Ohara YouTube Embed
Post by: dorelse on August 20, 2019, 03:19:25 PM
Any ideas on why I'm not seeing any videos?  Just empty space when trying to link in a youtube video?  The install worked just fine!  I'm stumped!

I had Aeva installed, which quit working a while ago...so loaded up Ohara today to re-enable embedded YT videos.  Settings do show up correctly under Miscellaneous.   I would appreciate any suggestions!

SMF Version 2.0.15
PHP 7.1


Title: Re: Ohara YouTube Embed
Post by: Suki on August 20, 2019, 04:25:09 PM
Check your browser console for any JS error or provide a link to your forum where a video is suppose to load, dummy credentials if its for members only, and I will take a look at it.
Title: Re: Ohara YouTube Embed
Post by: Sir Osis of Liver on August 20, 2019, 04:30:41 PM
If you are running privacy or tracking protection in your browser, you'll get blank screen.
Title: Re: Ohara YouTube Embed
Post by: dorelse on August 20, 2019, 07:00:52 PM
Check your browser console for any JS error or provide a link to your forum where a video is suppose to load, dummy credentials if its for members only, and I will take a look at it.

Here's a direct link to the thread I pictured.  Thanks for taking a look!

http://forum.cgoamn.com/index.php?topic=8292.0

I do see a couple .js errors...added a screenshot...clearly not finding something thus the 404 error.
Title: Re: Ohara YouTube Embed
Post by: dorelse on August 20, 2019, 10:43:19 PM
Check your browser console for any JS error or provide a link to your forum where a video is suppose to load, dummy credentials if its for members only, and I will take a look at it.

Suki - Thanks for pointing me in the right direction.  I have copied the missing files to the right location and we're all set.  It looks like a former mod recovered part or all of the site and now, I've been left with a site that is 90% running out of the correct location, and 10% is running from the recovered files directory.  That explains why some files were missing after the mod install.  (youtube.gif, etc...plus a couple key files.)

So, I have a mess to clean up.

We're all set.  Thanks! 
Title: Re: Ohara YouTube Embed
Post by: sirfpsycho on September 22, 2019, 10:54:55 PM
for twitter this type of mod?
Title: Re: Ohara YouTube Embed
Post by: shadav on September 22, 2019, 11:49:24 PM
for twitter this type of mod?
??? since when did twitter become youtube?
this mod has nothing to do with twitter
search is your friend ;) https://custom.simplemachines.org/mods/index.php?action=search;basic_search=twitter

just a friendly suggestion, don't go asking about other mods in a post about a different mod (unless they are related or conflict), you're best bet is to start a new thread asking for help to find something (usually in the mod request forum)