News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Simple Audio Video Embedder

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

Previous topic - Next topic

@rjen

Quote from: vbgamer45 on August 22, 2016, 03:41:31 PM
I don't see any missing  code below

<div id="fb-root"></div><script>(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return;  js = d.createElement(s); js.id = id;  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";  fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));</script><div class="fb-video" data-allowfullscreen="1" data-href="https://www.facebook.com/video.php?v=$5"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/video.php?v=$5"><a href="https://www.facebook.com/video.php?v=$5"></a></div></div>


Not sure what the exact problem is.  It only breaks the template when quoted though. Does that help?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

vbgamer45

Yeah max width doesn't appear to be a setting for this embed. Will have to see if Facebook supports it.
Community Suite for SMF - Take your forum to the next level built for 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

shawnb61

Quote from: @rjen on August 22, 2016, 03:50:29 PM
Quote from: vbgamer45 on August 22, 2016, 03:41:31 PM
I don't see any missing  code below

<div id="fb-root"></div><script>(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return;  js = d.createElement(s); js.id = id;  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";  fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));</script><div class="fb-video" data-allowfullscreen="1" data-href="https://www.facebook.com/video.php?v=$5"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/video.php?v=$5"><a href="https://www.facebook.com/video.php?v=$5"></a></div></div>


Not sure what the exact problem is.  It only breaks the template when quoted though. Does that help?

Do you need to close out the blockquote?
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

vbgamer45

Might be will try an update for that.
Community Suite for SMF - Take your forum to the next level built for 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

SMFHacks.com Team

3.6.4
!Fixed unclosed <blockquote> in facebook videos
+Added max,width height support for facebook videos
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

@rjen

I installed the new version: it stills shows as version 3.6.3 even though the download is 3.6.4.?

And it does fix the max-width issue, but is still has problem with the blockquote...

http://test2.fjr-club.nl/index.php?&topic=116.msg171708#msg171708
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

DarkAngel612

Quote from: @rjen on August 23, 2016, 03:53:55 PM
I installed the new version: it stills shows as version 3.6.3 even though the download is 3.6.4.?

And it does fix the max-width issue, but is still has problem with the blockquote...

http://test2.fjr-club.nl/index.php?&topic=116.msg171708#msg171708

Me 2, I checked the files and the package info file says it is 3.6.3 and I just now downloaded it. In package manager is claims to still be 3.6.2

I also got an error for the second edit in sources/post.php so had to manually edit that file
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

shawnb61

Similar here - the current file, named 3.6.4, shows up as 3.6.3 in package manager.   It installed cleanly though. 

The .mp4 problem still exists. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

vbgamer45

Community Suite for SMF - Take your forum to the next level built for 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

DarkAngel612

Thank you my friend and yes it shows now as 3.6.4 not the 3.6.4a that the info file says it is, no problems.

This however is still happening and as you can see by the image...the problem it says it has with the sources/post.php file

This is what the file at approx. line 1540:

// Let's see if there's still some content left without the tags.
        if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><div><div>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '') === false))
            $post_errors[] = 'no_message';


So maybe it can be updated with the next revision, just wanted you to know.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

vbgamer45

That can happen if an old version modified it or another mod.
Community Suite for SMF - Take your forum to the next level built for 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

DarkAngel612

Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

shawnb61

#2573
There are two issues with .mp4s on my site:
    1) They're too tall.  Height is 640 & the width is 425
    2) The filename is getting truncated, so the file is not found, so, they don't work

I think I figured out how to fix them; I'm a noob at this, so consider these suggestions...

Height...
  • You have logic that starts with embedcode & does some height & width substitutions when building your output.  For these substitutions to work, the height in the default embedcode must be 600 & the width must be 480.  This doesn't work for .mp4s because the height for them in AutoEmbedMediaProInstall2.php (lines 483-490) is 640.
  • To fix - Change those to 600, and the height/width substitution logic works and transforms them to a more reasonable 350/425. 
  • Suggestion 1 - Review all of your embedcodes looking for dimensions not 600/480 - the substitutions won't work for them.  There are a few others. 
  • Suggestion 2 - If you do Suggestion 1, you can get rid of the extra check for data-height of 640 on line 253 in AutoEmbedMediaPro2.php.  Seems to have been a quick fix...
  • Suggestion 3 - Why the height/width substitutions at all?  Why not just put the target dimensions in the embedcode to begin with?  I am assuming you are considering making the dimensions user-editable in the future.  If so, you must do Suggestion 1 or some won't work.  If not, there is some room for simplification here.
Filename Truncation...
  • I believe this is due to an extra period in the regexmatch, the one after the (.*).
  • To fix - get rid of the extra period in the regexmatch for .mp4.  It acts as a 3rd wildcard, and if you don't do something with $3 it simply goes away - and takes the last byte in your filename with it.
  • Suggestion 1 - Look at all similar regexmatch patterns.  I think all of the "local" patterns use this same approach.  Hence, I'm not sure any of them work at the moment.

Hope this is on track.  If I'm correct, the only changes needed are in AutoEmbedMediaProInstall2.php, as this is where the regexmatch & embedcodes are defined and loaded into the DB. 

This gets rid of 2 of the 4 problems reported back in post 2530 by another user.  The other 2 are still open & valid, I think...

You youngun' programmers...  This ain't code, it's punctuation run amok...
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

vbgamer45

Thanks that seems to fix those issues.
In regards to height/width substitutions there is a setting to set the default height/width which why that is used.
Community Suite for SMF - Take your forum to the next level built for 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

SMFHacks.com Team

3.6.5
!Fixed issue with local embeding of files which might take part of the filename out thanks to  shawnb61
!Fixed height issue for some local embeded files thanks to  shawnb61
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

nax

Just installed 3.6.5 error in the version no of this file I get:-

Your Version: 3.6.5 Latest Version: 3.6.4 Your Simple Audio Video Embedder version is not up to date!
Download a the latest version now!

vbgamer45

Community Suite for SMF - Take your forum to the next level built for 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

shawnb61

I still can't use local links due to the two remaining problems reported back in post 2530.  I have disabled Local usage - it appears to work fine with everything else. 

I think I figured out how to fix the two remaining issues.  I'm still learning, so once again consider these suggestions & food for thought...

The two remaining issues:
    1) https doesn't work for local ogg & webm
    2) Lists of links within the same message get mangled - and my site has lots of lists of links

Local https...
  • Both ogg and webm are hard-coded to work for http only, not https. 
  • To fix - Lines 683 - 701 in AutoEmbedMediaInstallPro2.php need the same "htt(p|ps)" treatment used by all of the other local types.  The regexmatch values must change to use the (p|ps) approach and the corresponding changes to use $1 & $2 must be made to the embedcodes.

Lists of links get mangled...
This is a bit more involved...  Since search expressions default to being "greedy" - finding the longest matches they can - the match is actually spanning links.  If you have a list of 3 links, and the top & bottom are .mp4, it will mangle this into one .mp4 consolidated link by using the <a href of the first with the </a> of the last.  You don't want ANY of these searches "greedy", you always want to look at  the shortest match between your search literals. 

To fix - Two parts... 
  • Change your primary search, line 259 of AutoEmbedMediaPro2.php, to be ungreedy with the ungreedy modifier, U.  Do this by changing the </a>#i to </a>#iU.   This fixes 90% of the problems in and of itself.  I'm willing to bet this makes SAVE more CPU efficient as well, because it will stop as soon as it finds a quick match.
  • Change the regex matches for all of the local filetypes to fail on a match that has a > prior to the suffix (e.g., .mp4).  I believe that changing the htt(p|ps)://(.*) to htt(p|ps)://([^>]*) will do the trick.  Even the U in point 1 above will not prevent it from matching the start of an .mp3 link to the end of an .mp4 link, because it's not excluding anything inbetween.

I've tested the above on my test site and so far I haven't seen any problems. 

WARNING - I've read that adding the U to make the searches "Ungreedy" actually reverses the action of the ? lazy modifier, making it mean greedy...  I suggest a thoughtful scan of the regexmatches to make sure ? isn't used as a lazy modifier anywhere, because its meaning will be reversed. 

But you're stuck either way - if you don't want to use the #iU, you need to either review all the multi-char terms like * and + and make them individually ungreedy with a ?, or, if you use the #iU, you should review all the ? terms and remove them wherever they were intended to make that particular term lazy, because they won't do that anymore. 

Still learning.  If I'm off-track, please let me know...
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

vbgamer45

You are on the right track. Have to fix the embeds with the ?
Youtube right now breaks and that is a big one

(1, 'Youtube','http://www.youtube.com', 385,640, 'htt(p|ps)://[" . '\\' .'\\' . "w.]+youtube" . '\\' .'\\' . ".[" . '\\' .'\\' . "w]+/watch[(" . '\\' .'\\' . "?|" . '\\' .'\\' . "?feature=player_embedded&amp;)" . '\\' .'\\' . "#!]+v=([" . '\\' .'\\' . "w-]+)[" . '\\' .'\\' . "w&;+=-]*[" . '\\' .'\\' . "#t=]*([" . '\\' .'\\' . "d]*)[&;10wshdq=]*','" . '<iframe width="480" height="600" src="//www.youtube.com/embed/$2?fs=1&start=$3" frameborder="0" allowfullscreen></iframe>' . "'),

Community Suite for SMF - Take your forum to the next level built for 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

Advertisement: