WordPress.org

Ready to get started?Download WordPress

Forums

WP YouTube Lyte
[resolved] This is exactly what I want! But What if I deleted the plugin for some reason? (20 posts)

  1. Kaleyko
    Member
    Posted 4 months ago #

    It would be way better if you make the plugin works with the default WordPress embedding... Just put the YouTube link and the plugin work with it, so if you deleted the plugin all the posts that you made months ago will still work.

    I mean what will happen if I deleted the plugin after months of using it? Will the videos show up or will be just httpv://youtube.com/example?

    https://wordpress.org/plugins/wp-youtube-lyte/

  2. futtta
    Member
    Plugin Author

    Posted 4 months ago #

    You can easily enable that with a couple of lines of code as documented in lyte_helper.php_example Kaleyko.

  3. Kaleyko
    Member
    Posted 4 months ago #

    Then, why didn't you do it from the start? Using the current technique could brake ALL of the previous video posts if someone decided to uninstall the plugin.

    Honestly, I won't post only audio YouTube video. I'm going to only put regular YouTube video.

    I opened the file, but I'm really not that good with a code if it's not CSS or HTML.

    Could you please do it for me and paste the code here and I will replace with the file by myself? I will really thankful.

    Finally, the available positioning of the video on the settings page are left and center only. I write in a language where the words start from right to left which means the video should be in the right. Would be really great if you add this with the next update.

    And a side question: I noticed that your plugin worked with iOS! Is this after the 7.1 update for iOS or what? Because I remember very good that this technique wasn't working with iOS and if you clicked the layer over the YouTube video it won't play and you won't see the original click to play button on the video.

  4. futtta
    Member
    Plugin Author

    Posted 4 months ago #

    Because I don't want Lyte to handle normal youtube links by default and because it's easy to enable using the API.

    What you want to do is:

    1. copy /wp-content/plugins/wp-youtube-lyte/lyte_helper.php_example to /wp-content/plugins/lyte_helper.php
    2. open the file and on line 23 remove the double slash at the beginning to have:
      add_filter('lyte_content_preparse','lyte_force_nonhttpv',10,1);
    3. enable the lyte helper plugin in your wordpress admin

    Concerning positioning of the player; you should be able to do that by applying some CSS to the lyte; float:left on lyte-wrapper and clear:both on lL should do the trick.

    Regarding playback on iOS; there were problems with that which were fixed in the latest release, should work fine on older versions of iOS as well.

    hope this helps,
    frank

  5. Kaleyko
    Member
    Posted 4 months ago #

    Awesome!

    I add it and enabled the new plugin. Do I need the two of them now or I can deleted the original one?

    And what is the different if I just removed the double slash and hit save without duplicating the lyte_helper.php_example to /plugins and renaming it lyte_helper.php?

  6. futtta
    Member
    Plugin Author

    Posted 4 months ago #

    No, you need the two of them; "lyte helper" relies on "wp youtube lyte".

    If you would make the changes to the original lyte_helper.php_example it would not appear in the list of plugins to be activated.

    have a nice weekend,
    frank

  7. Kaleyko
    Member
    Posted 4 months ago #

    Thanks.

    I just noticed an issue: The hyperlinks with YouTube videos shows the whole embedded video blew the hyperlink!

    In some posts that's destroyed the whole layout of the website.

  8. futtta
    Member
    Plugin Author

    Posted 4 months ago #

    Not sure I understand, can you provide a link (to a blogpost with the problem or to a -partial- screenshot)?

  9. Kaleyko
    Member
    Posted 4 months ago #

    Hyperlink: This is a link.

    Plain Link: http://youtube.com/example.

    Both shows embeded YouTube videos.

    The hyperlink should not show an emended video at all. It's a hyperlink that the visitor click and he will go to YouTube and watch the video from there.

  10. futtta
    Member
    Plugin Author

    Posted 4 months ago #

    ah, that's one of the reasons I don't like WP YouTube Lyte to automatically parse normal youtube URL's ;-)

    Anyway, that's something that can be changed in the example code in lyte_helper.php.

    On line 25 you could try changing

    $content=preg_replace('/https?:\/\/(www.)?youtu(be.com|.be)\/(watch\?v=)?/','httpv://www.youtube.com/watch?v=',$content);

    into for example (off the top of my head, not tested, this could start a thermo-nuclear war)

    $content=preg_replace('/\shttps?:\/\/(www.)?youtu(be.com|.be)\/(watch\?v=)?/','httpv://www.youtube.com/watch?v=',$content);

    This way only links that have a space before them would be turned into a lyte vid (but you'd have to add that space, always in order for lyte to pick that up).

  11. Kaleyko
    Member
    Posted 4 months ago #

    ah, that's one of the reasons I don't like WP YouTube Lyte to automatically parse normal youtube URL's

    Isn't this a bug from your side? I'm pretty sure WordPress won't show embedded YouTube videos if you used a hyperlink, this happens only when this plugin is active.

    And the way you provided won't be useful.

    I'm not sure what should I do now. I mean what if you decided to stop working in the plugin one day and WordPress updated something? ALL of the YouTube post will be broken, not to mention that the videos won't show up on the RSS Feed for the readers. (With normal YouTube links you will achieve two things: A) When you stop developing the plugin or someone uninstalled it, video posts will remain working without issues. B) The RSS Feed will detect the normal YouTube video and show it up, too.)

    Thanks so much for your time and your fast replies, but I think you could review the way you developed this plugin to be better for long-terms.

    Not sure if you could help me more than that...

  12. futtta
    Member
    Plugin Author

    Posted 4 months ago #

    It's not a bug, as this working WP YouTube Lyte by default only works on httpv-links. I just provided you with some example code that can be used to extend the default behavior and there clearly is room for improvement in that "proof of concept"-code.

    But anyway, as for your dilemma; you can do 3 things:

    1. use wp youtube lyte as is, using httpv-links, which will indeed require you to stick to wp youtube lyte (or other plugins that support httpv)
    2. use the wp youtube lyte API to extend the behavior, based on the example code I provided (it's a question of tweaking the regular expression, nothing fancy really)
    3. use another youtube-plugin (there are plenty), each with their own advantages and disadvantages off course.

    hope this helps,
    frank

  13. peter-a
    Member
    Posted 3 months ago #

    Hi Frank,

    I really like how well your plugin performs, with greatly improved page-load times, and it also shows the video previews perfectly.

    I also share the same concern as Kaleyko, where I would rather this plugin took any YouTube URL (http or https) that is on a line by itself (but not in a link or on a line with other text) and rendered the lyte YouTube preview… Maybe you can provide the option in a future version?

    For ideas, you can have a look at the Lazy Load for Videos plugin, which has some similar functionality.

  14. futtta
    Member
    Plugin Author

    Posted 3 months ago #

    For now this is not possible, but as I wrote earlier this can be accomplished by using the API. Actually the example code above only some small tweaks to do what you need it to do :-)

  15. peter-a
    Member
    Posted 3 months ago #

    Thanks Frank. Unfortunately I am not a programmer, so those small tweaks are beyond my abilities. Maybe someone can tell us how to do it?

  16. futtta
    Member
    Plugin Author

    Posted 3 months ago #

    ok, ok ...

    this seems to work; a youtube-link on a newline is parsed, others (link in a text, link in a href, ...) are left alone;

    /** force wp youtube lyte to act on normal youtube url's as well using lyte_content_preparse filter */
    add_filter('lyte_content_preparse','lyte_force_nonhttpv',10,1);
    function lyte_force_nonhttpv($content) {
            $content=preg_replace('/^https?:\/\/(www.)?youtu(be.com|.be)\/(watch\?v=)?/m','httpv://www.youtube.com/watch?v=',$content);
            return $content;
            }

    You might want to test this thoroughly, I'll add this update to lyte_helper in a next release. You can activate it by following the directions from above and then changing that code a bit to match what is here.

  17. peter-a
    Member
    Posted 3 months ago #

    Thanks very much Frank! I'll give it a try. :-)

  18. futtta
    Member
    Plugin Author

    Posted 3 months ago #

    are you happy, peter-a? :-)

  19. peter-a
    Member
    Posted 3 months ago #

    Yes, very happy! Thanks Frank, this is working great. :-)
    It'll be nice to see it in the next version as well.

  20. Kaleyko
    Member
    Posted 3 months ago #

    Frank, thank you so much!

    Just pasted the new code snippet and it's working exactly like what I want.

    Thanks again, because of your help, our website's home page speed went from 7s to 1s! (We post TONS of YouTube videos.)

    Wish you could make it a native optional thing for the users to choose, with the next update.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.