Advertisement:

Author Topic: Ohara YouTube Embed  (Read 199316 times)

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #60 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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline simon36

  • Jr. Member
  • **
  • Posts: 111
Re: Ohara YouTube Embed
« Reply #61 on: April 17, 2012, 08:54:48 AM »
Thanks Suki, I edited the file and it displays the way I want it to now.

Offline katoon123

  • Semi-Newbie
  • *
  • Posts: 30
Re: Ohara YouTube Embed
« Reply #62 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 ; )

Offline natas

  • Newbie
  • *
  • Posts: 4
Re: Ohara YouTube Embed
« Reply #63 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.

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #64 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
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline natas

  • Newbie
  • *
  • Posts: 4
Re: Ohara YouTube Embed
« Reply #65 on: May 26, 2012, 11:46:49 AM »
Thanks for the reply and thanks for the mod.

Offline Grimster

  • Newbie
  • *
  • Posts: 2
Re: Ohara YouTube Embed
« Reply #66 on: June 18, 2012, 09:01:05 AM »
Thanks for a great mod Suki  ;D

Offline dzoni22

  • Newbie
  • *
  • Posts: 5
Re: Ohara YouTube Embed
« Reply #67 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.  ???

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #68 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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline Forces of Steel

  • Newbie
  • *
  • Posts: 1
Re: Ohara YouTube Embed
« Reply #69 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.

Offline BigMike

  • Full Member
  • ***
  • Posts: 637
  • Gender: Male
    • http://facebook.com/huusoku on Facebook
    • Marlin Crawler, Inc.
Re: Ohara YouTube Embed
« Reply #70 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:
  • For theming, I am using SMF's own catbg h3 style to match the forum's existing headers.
  • I am using a thin border of color #9999AA which you'd want to change to match your forum as needed.
  • Trimming the title at 50 characters works for me (I am using a larger than default video size), so also change this trim number as desired to go along with your own video width.

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

Original method:
         
New method:


...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

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #71 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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline BigMike

  • Full Member
  • ***
  • Posts: 637
  • Gender: Male
    • http://facebook.com/huusoku on Facebook
    • Marlin Crawler, Inc.
Re: Ohara YouTube Embed
« Reply #72 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

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #73 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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline Kurogane

  • Semi-Newbie
  • *
  • Posts: 74
Re: Ohara YouTube Embed
« Reply #74 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.

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #75 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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline Kurogane

  • Semi-Newbie
  • *
  • Posts: 74
Re: Ohara YouTube Embed
« Reply #76 on: September 12, 2012, 05:35:16 PM »
Already did multiple times and still not working in my other template or default theme.

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #77 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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline Kurogane

  • Semi-Newbie
  • *
  • Posts: 74
Re: Ohara YouTube Embed
« Reply #78 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


Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #79 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)
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.