Support » Plugin: YT Player - Youtube Video Player, YouTube Embed » Error generating variable based on Youtube ID

  • Resolved fabioaarito

    (@fabioaarito)


    Hey guys,

    First of all, thank you for your amazing work with this plugin.

    I think I found a bug in the generator of the $selector variable you are using to generate an element id for the player.
    You are doing that based on the youtube video ID and you are assuming the ID is the last 4 characters of the youtube video.

    There are situations where the youtube video has special characters (even in the last 4 characters). If that happens your shortcode will fail because you have a JS variable that is the $selector and variables can’t have special characters.

    Example:
    – Youtube ID: ybCsxtpp-Q
    – $id = ybCsxtpp-Q
    – $selector = pp-Q

    In this case you will see a JS error:

    “Uncaught SyntaxError: Missing initializer in const declaration”

    because the const name is “pp-Q”.

    In my option it’s ok to have “-” in the selector variable but we can’t use it as a variable name.
    Other option is to use another approach to extract the $id where you can ensure the variable won’t have special characters.

    Thank you again for your amazing contribution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bPlugins_LLC

    (@abuhayat)

    Hi
    Thanks for the feedback, I will fix it soon !
    Have a nice day !

    Plugin Author bPlugins_LLC

    (@abuhayat)

    @fabioaarito I have updated my plugin few second ago and fixed the issue, Thanks for your collaboration. I appreciate your rating / review.
    Have a nice day !

    Thread Starter fabioaarito

    (@fabioaarito)

    Thank you for the quick fix 🙂 I’ll update the plugin during the weekend.
    And I’ll certainly provide a rating for your amazing work 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error generating variable based on Youtube ID’ is closed to new replies.