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

lord alibaski

Hi vb

I have just ran into a small problem, long story cut short I had to uninstall all mods and remove all hooks from older mods on my forum but when re-installing this mod I now have a HTTP500 error. I have tried running settings_repair but it hasn't worked.

This happened to me years ago with this same mod but I have forgot how I fixed it have you any ideas how this can be fixed?

Thanks


vbgamer45

Check your web server error log or smf's error log.

Fixing is hard to tell without the exact cause.  You can try installing manually and running the setup to create hooks but can be a little tricky.
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

lord alibaski

No error logs on web server but I am seeing these errors via ftp have a look at the attachment 

lord alibaski

#3683
I've sorted it I had to delete subs folders for the Embedder and it fixed the HTTP500 error will try and install it again see if it happens again.

Well that caused more problems than I wanted look at these problems now

lord alibaski

Well I tried a forum upgrade to clear things but it's still giving me the modification parse error.

I have asked for help in the 2.1 support forum because it seems I am having problems installing any mods.

Chen Zhen

Nice mod you got here VB.



Is it possible to add multibyte support?

I was testing the installation in a utf8mb4 environment which results in an error due to using direct DB queries for creating tables. Specifically the mediapro_cache table's secondary key "mediaurl" which is set at varchar(255) results in an error due to too many bytes (there are 6 columns within various tables that may cause an issue with utf8mb4).

For the SMF 2.1 branch if you use the built in function $smcFunc['db_create_table'], it will detect utf8mb4 and create varchar tables at a max of 191 bytes. Either that or the table status can be checked to find out if the db is utf8mb4 & then max out any varchar tables to a variable (191 or 255). The latter will work for both branches.

My SMF Mods & Plug-Ins

WebDev

SMF support staff should be shaping a positive community experience & not provoking an argument or emotional reaction.

vbgamer45

What is the exact error returned? I am surprised that a larger varchar would cause the issue. Unless the table has many columns and you are trying to create an index.

The reason I personally avoid db_create_table is mainly due to seeing the table structure at a glance/copying reusing the same code for other platforms other than SMF and not a fan of query builders/orm in genral.
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

Mike66

Can Simple Audio Video Embeder embed videos that have been uploaded to SMF Gallery Pro?

Or can videos in SMF Gallery Pro have a BB code link to display/play a video in a post like the images do?

Cheers
Mike

vbgamer45

Simple Audio Video Embeder can autoplay local videos that end .mp4 extension those play natively in the browser.

The BB code in SMF Gallery Pro for videos only gives link an html link not the url currently.
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

Mike66

That works thanks  :)

I enabled/ticked "Local/Remote MP4" in the Simple Audio Video Embedder settings and the test video is playing in the post.

I guess members would have to learn to extract the video address from the html link code, or to right click on the video in the gallery and select "Copy video address".

Cheers
Mike

vbgamer45

Yeah I can add a full link option in smf gallery pro if that helps.
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

Mike66

Quote from: vbgamer45 on December 12, 2023, 03:10:38 PMYeah I can add a full link option in smf gallery pro if that helps.

Cool, I think that'd be useful.

Chen Zhen


The error was:
QuoteSpecified key was too long; max key length is 1000 bytes

This is because mediaurl is designated as a secondary key in the mediapro_cache table when the table is created in a utf8mb4 environment. This throws the error shown above when running the installer for the first time.

I understand about not using all of SMF's native functions as I don't always use them myself in some scenarios.

I've used something like this in some of my projects (also gathers some other data):
global $smcFunc, $db_name;
if (strpos($db_name, '.') === false)
$result = $smcFunc['db_query']('', "
SHOW TABLE STATUS FROM {raw:db_name}",
array('db_name' => $db_name)
);
else
$result = $smcFunc['db_query']('', '
SHOW TABLE STATUS FROM `' . $db_name . '`',
array()
);

while ($val = $smcFunc['db_fetch_assoc']($result))
{
$charsetx = explode('_', $val['Collation']);
$collationSet = !empty($collationSet) ? $collationSet : $val['Collation'];
$current_db_values = array(
'engine' => $val['Engine'],
'collation' => stripos($val['Collation'], 'utf8mb4') !== false ? 'utf8mb4' : 'utf8',
'charset' => $charsetx[0],
);
}
$smcFunc['db_free_result']($result);
$varcharSize = $current_db_values['collation'] == 'utf8mb4' ? 191 : 255;

Then in the installer just create varchar's that max out at the $varcharSize variable.
Something like that will make it compatible with utf8mb4 (SMF 2.1 branch is already utf8mb4 friendly).




My SMF Mods & Plug-Ins

WebDev

SMF support staff should be shaping a positive community experience & not provoking an argument or emotional reaction.

vbgamer45

Ah so probably should not make it utf8mb4 and force a character set on that table would be the fix.
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

Chen Zhen


Are you saying to force a different table collation (for this mod's tables) on someone's utf8mb4 environment? I don't think that's a good idea as it may result in mixed collation errors.


 

My SMF Mods & Plug-Ins

WebDev

SMF support staff should be shaping a positive community experience & not provoking an argument or emotional reaction.

vbgamer45

Yes, generally that shouldn't be done. But this table isn't joined with any other table nor would I expect to be using a charset other than utf8/latin1 with the data that it contains.
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

vbgamer45

@Chen Zhen realized mediapro_cache table is not needed at all.. not used in the code just removed it and updated the mod.  Added that table for an idea but never did it.
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

Chen Zhen


Great..  I still think adjusting the varchar columns to a variable byte size dependant on collation would be prudent. Anyone with that collation set for their DB may get errors at some point. All good for me though as I can adjust it myself.

My SMF Mods & Plug-Ins

WebDev

SMF support staff should be shaping a positive community experience & not provoking an argument or emotional reaction.

nfpuu1u

Only a short side note:

I have noticed that version 7.0.3 and 7.0.3a has been released in the meantime but the first topic of this thread as well as the Mod entry on the Customization Site is only listing version 7.0.2 and below.


Steve

The mod entry on the customization site is showing 7.0.3a for me.


@vbgamer45 - any way of adding TMZ to the list of videos? Sample link:

https://www.tmz.com/watch/2023-12-15-121523-ukraine-grenade-1744391-872/
My pet rock is not feeling well. I think it's stoned.

Advertisement: