Long story short: to support YouTube tracking we need the “enablejsapi” parameter to be true (1) in the YT embed code URL, we also need a way to reference the iframe for example using the id attribute.
My suggestion is in the
get_the_post_video()function located in general.php add a filter on the embed code and preferably also on the source URL. Ideally I’d like to be able to choose my own attributes and source parameters entirely but I guess it would be acceptable to manipulate the entire HTML as well.
As of now we must hardcode changes in the source code to get the intended behaviour, of which are of course overwritten on update.
thanks for reporting. I recommend hard coding it for the moment (
php/general.php) – will add an ID and the enablejsapi parameter to the media settings with the next update.
Not sure which other parameters you would need? I guess I already added most of them to the settings.
Hi Alex, thanks for the quick response.
I guess your suggested changes would handle my immediate case, just figured it’s more flexible if one could change/add/delete attributes or parameters on demand instead of it having to go through the development process everytime.
The filter on embed code would be very handy btw, in the ideal world I’d like to print some HTML/script code together with the embedded video.
Thanks for the suggestions.
I guess the objective of the plugin is to replace featured images without any hassle and make the videos simply fit the existing layout. I already use a
divaround the embed/iframe which then can be customized using CSS and the media settings.
Still, I will consider adding a filter. If you like I really would appreciate a rating for the plugin.
the Plugin now features a filter, iframe id for YouTube videos, enablejsapi and playerapiid paramters.
Everything works fine?
Hi Alex, thank you very much.
Ideally I’d prefer if the
$meta['prov']value was given as an argument to the filter so I could more reliably detect if the video is a youtube video, but I got it working fine for now. Either way this is 100 times better than having to hardcode the values in your plugin files 🙂
I must admit I’m a bit surprised you actively support people here. I will surely rate your plugin 🙂
- The topic ‘Need filter for iframe and embed code manipulation’ is closed to new replies.