1
votes

I'm trying to figure out how I can specify a custom end time for YouTube video. I am using the following shortcode to embed YouTube videos on my website.

[video type="video/youtube" src="https://www.youtube.com/watch?v=nlvVGwssklQ"]

I need to specify different end times for each video on the website. I am looking for something like:

[video type="video/youtube" src="https://www.youtube.com/watch?v=nlvVGwssklQ" **end="2m6s"**]

1

1 Answers

1
votes

It seems you are using the MediaElement plugin for WordPress. The plugin description does not show an option for setting the end time for YouTube videos.

You need to customize the plugin so it allows setting the end time. The MediaElement documentation has a function called getCurrentTime() which returns the current playing time of the video. You can check if the current playing time is equal to your end time and if so, stop the player. You can add this check within the handler for timeupdate event.

Another option is to post a feature request on the plugin support forum