News:

Wondering if this will always be free?  See why free is better.

Main Menu

Simple Audio Video Embedder

Started by SMFHacks.com Team, August 09, 2010, 10:42:47 PM

Previous topic - Next topic

Steve

You could uninstall one of them and then try to install this. If the error persists, you could try uninstalling the other. Otherwise: https://wiki.simplemachines.org/smf/Error_in_mod_installation
My pet rock is not feeling well. I think it's stoned.

Sono

Quote from: Steve on January 23, 2024, 07:18:53 AMYou could uninstall one of them and then try to install this. If the error persists, you could try uninstalling the other. Otherwise: https://wiki.simplemachines.org/smf/Error_in_mod_installation

Okay but what is that <img> tag for originally in the subs.php, and why does the embedder wants to replace it? If I could understand that, I could look much more effectively for the mod that deleted it.

Arantor

It's in the bowels of the bbc parser.

Basically there's a check after bbc is parsed that the post contains some content. By default it removes all tags (except img) and white space to verify there is some actual content.

This mod extends the list to more than just the img tag. Just do a search on Subs.php for the <img> part on its own (no quotes) and you'll find it.
Holder of controversial views, all of which my own.


Sono

Quote from: Arantor on January 23, 2024, 11:56:21 AMIt's in the bowels of the bbc parser.

Basically there's a check after bbc is parsed that the post contains some content. By default it removes all tags (except img) and white space to verify there is some actual content.

This mod extends the list to more than just the img tag. Just do a search on Subs.php for the <img> part on its own (no quotes) and you'll find it.

I have downloaded the 2.0.19 installer, checked the Subs.php file, but even in that one, that is an original version of the file, there is no tag on its own in this form: <img>. And there are 48 img scattered in the code, well I have no clue which one it would like to modify. Can you suggest what I should look for around that img that it wants to modify? How the code around it might look like or what it contains?

Secondly, I installed the mod anyway with the test failing on Subs.php. It does work, embed videos. But the Facebook video embeddig has a glitch: when the link is like: "fb.watch....", it works fine. when the link is like: www.facebook.com/..... (these are links from videos shared on someone's wall), you cannot share another FB video below that, because it wont appear. so this combination does not work:

www.facebook.com/.....

fb.watch........

The second video won't appear, or any other Facebook video shared after it. If the next video is from another site, like Dailymotion, it does, but after facebook.com type of links if you share another facebook video, it does not work. What can be the problem there?

Also, in case of the facebook.com type of links the video sizing is abnormally large, it extends out of the screen vertically. And the video display script does not take height setting in the mod into consideration. The Facebook script only considers the width setting, but that is not convenient for other videos. Videos from other sites work better, they appear just at the right size, not too large, not too small. fb.watch  type of links also display videos at the convenient size.

Arantor

My bad, it's not in Subs.php, it's in Post.php - though honestly... the failure *should* have told you it was in Post.php...

The original bare lines:
// Let's see if there's still some content left without the tags.
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
$post_errors[] = 'no_message';
Holder of controversial views, all of which my own.


Sono

Quote from: Arantor on January 23, 2024, 07:00:14 PMMy bad, it's not in Subs.php, it's in Post.php - though honestly... the failure *should* have told you it was in Post.php...

The original bare lines:


Oh, sorry, it was my fault, I was looking at the line above the one concerned. It is post.php indeed. Anyway, I managed to trace things back, and this is what I found:

So the Simple Video Embedder is failing on this two:

Code: (Find) [Select]
'<img>'
Code: (Replace) [Select]
'<img><object><embed><div><iframe><blockquote><video><audio>'

Code: (Find) [Select]
'<img>'
Code: (Replace) [Select]
'<img><object><embed><div><iframe><blockquote><video><audio>'

Well, I am not an SMF expert, but I find it strange it wants to do the modification twice? However, I do found there are two '<img>' tags in the code. So probably it wants to modify both. Both however is modified in my forum code. This is what I found:

1. Simple Youtube Embedder modified the first '<img>' (but maybe it made an error because the resulting code is strange):
The modification command:
<file name="$sourcedir/Post.php">
<operation>
<search position="after"><![CDATA[<img>]]></search>
<add><![CDATA[<object><embed><iframe>]]></add>
</operation>

<operation>
<search position="after"><![CDATA[<img>]]></search>
<add><![CDATA[<object><embed><iframe>]]></add>
</operation>
</file>

The result that is the current state in Post.php:
// Let's see if there's still some content left without the tags.
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<object><embed><iframe><object><embed><iframe><img>')) === ''

You see it double modified this part, but did not touch the next '<img>'

2. The next '<img>' was modified by SoundCloud Embedder:

The command was:
<operation>
<search position="before"><![CDATA[if ($func['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>]]></search>
<add><![CDATA[<object>]]></add>
</operation>

And indeed the change is there in the recent code, so it looks like this now:
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><object>')) === '')
{

So what do you suggest here? I guess the Youtube embedder should be uninstalled, but what about the next part modified by SoundCould embed? Should I just leave that mod installed, install Simple Video Embedder and modify Post.php manually to its requirements? Maybe the two mod will clash on that second <img> tag part?

Anyway, I tried installing Simple Video Embedder just like that, failing on that two <img> tag, skipping that modification, and it does work even like that, without the change in Post.php.




Arantor

It wants to do it twice because, presumably, there's two of them. And when I suggested to search for the bare img tag, I was rather making the assumption you were doing this change by hand and not patching the installer so what you got is it doing exactly what you told it to do: find the *first* occurrence of <img> in the file (twice) and replace it.
Holder of controversial views, all of which my own.


Sono

Quote from: Arantor on January 24, 2024, 04:55:20 AMIt wants to do it twice because, presumably, there's two of them. And when I suggested to search for the bare img tag, I was rather making the assumption you were doing this change by hand and not patching the installer so what you got is it doing exactly what you told it to do: find the *first* occurrence of <img> in the file (twice) and replace it.

Of course I don't touch the installer I just pasted the commands to show how things resulted in the current state.

I see that Simple Video Embedder supports Soundcloud so I will remove the recent soundcloud mod as well. Then the code should be pristine for the mod to install and no clashes.

However, there is still the problem that I mentioned earlier: when testing the Simple Video Embedder mod I found that in case the link to process is something like "www.facebook.com/" and not "fb.watch.." etc. , you cannot paste more than 1 video. If you do, the 1st one appears, the second not. What may cause this?

And, in case the link is: "www.facebook.com/" type, the appearing video is too high. Even if you select "use custom div class" in the mod settings, and you set: max -height: 400px, it does not affect the embedder. Not even if you set a height in the mod settings. The Facebook embedder script ignores those settings and the displayed video will be 1000px or so. You can see this on the photo below, max-height: 400 was set for the mod div yet the Facebook video iframe is about totally different sizes:




Ignore the height:500 at the bottom that one was me who modified it in the inspector of the browser.

Sono

Yet another problem I noticed: Youtu.be type links are not processed, they do not display video, just left as is. I had to reinstall my previous Youtube Embedder Mod manually, a very old, discontinued one, to display those videos. Installing it over the Simple Video Embedder.

vbgamer45

What is the youtu.be  link that isn't embedding?
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Sono

https://youtu.be/Y68L_4eetpY?si=Kct4SKRhSDyPhUUj

I have done a clean install: that means all the previous problems I reported before was solved, so the installer did not report Test Failed on any of the steps. I also removed every other video/audio embedder.

And this is the type of Facebook link that does not display if you put 2 below each other:
https://www.facebook.com/1789207271/videos/401632332543481/

The first with such a link does, the next and other does not. This does not happen if you use fb.watch links in multiple. And the sizing of the video in case of this type of link ignores the settings in the mod. I set the height to 500px, but it ignores and displays the video with such specs:

<video height="828" width="466" preload="auto" style="display: block;" class="_ox1 _21y0" data-video-width="466" data-video-height="828" id="u_0_5_9o" src="blob:https://www.facebook.com/617fb98c-2f45-460b-b5e6-843c41b62cc0"></video>

Steve

As I've said multiple times in this topic, if you're going to use the youtu.be/ url then you MUST remove everything to the right of and including the ? and it will work fine.

So you would post: https://youtu.be/Y68L_4eetpY in your example.
My pet rock is not feeling well. I think it's stoned.

Sono

Quote from: Steve on January 26, 2024, 03:27:21 PMAs I've said multiple times in this topic, if you're going to use the youtu.be/ url then you MUST remove everything to the right of and including the ? and it will work fine.

So you would post: https://youtu.be/Y68L_4eetpY in your example.

But do you think this is how the everyday average user not knowing anything about SMF and mods will do this? Come on. Is this how a solution for embeddig should work? Especially that there has already been another mod that I installed maybe 10 years ago, it has already been removed from the SMF inventory, yet that can display youtu.be links properly, while this one concerned in this topic, that is still supported can't. Don't want to blame the developers, but what you suggest is nonsense.

Steve

Quote from: Sono on January 26, 2024, 03:51:25 PMCome on.
Quote from: Sono on January 26, 2024, 03:51:25 PMbut what you suggest is nonsense.
Both those comments were unnecessary. I agree, the average user is not going to know or remember how to do that. I was simply letting you know of a way to make it work using that url. It's up to the developer of this mod on whether or not he wants to make it work that way.

I'm not sure why you want to use the youtu.be url when the normal one in the address bar works perfectly.  :)
My pet rock is not feeling well. I think it's stoned.

Sono

Quote from: Steve on January 26, 2024, 04:24:47 PMI'm not sure why you want to use the youtu.be url when the normal one in the address bar works perfectly.  :)

You must address this question to my forum members, why they constantly use those. But it seems there is a need by nature for the forum to be able to handle it.

Steve

The only time (that I know of) to get that url is if a user clicks the share button below the video. As you say, you have forum members that prefer to do it that way and that leaves it up to the developer as I said previously.

So we are in agreement. Old habits die hard.  ;D
My pet rock is not feeling well. I think it's stoned.

CreativeITWorld.com

Regarding https://youtu.be/Y68L_4eetpY?si=Kct4SKRhSDyPhUUj

A simple way to get rid of the ?si= and everything after it is to use the built in SMF Censor.

Find ?si=
Replace it with a space and a break <br>.

vbgamer45

I spent quite a bit time on that...haven't been able to get it work with regex.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Sono

Quote from: vbgamer45 on February 02, 2024, 09:04:42 AMI spent quite a bit time on that...haven't been able to get it work with regex.

Why don't you just take the code from the old discontinued mod and incorporate it into yours? Then we wouldn't need to overinstall the old mod to yours.

Arantor

Holder of controversial views, all of which my own.


Advertisement: