Start at a Specific Place on Seekbar

Environment

Product MediaPlayer for ProgressĀ® Kendo UIĀ®
Product Version 2019.1.115

Description

How can I programmatically start my video at a specific place the first time it is played?

Solution

In order to have a different start time when a video loads in a Kendo UI MediaPlayer, use the seek method the first time the play event is fired. Utilize the Kendo Observable's one method to attach a handler for one-time execution.

    <div id="mediaplayer" style="height:360px"></div>

    <script type="text/javascript">
      $(document).ready(function(){
        $("#mediaplayer").kendoMediaPlayer({
          autoPlay: true,
          navigatable: true,
          media: {
            title: "ProgressNEXT 2018 Highlights",
            source: "https://www.youtube.com/watch?v=Gp7tcOcSKAU"
          }
        });

        var mediaPlayer = $("#mediaplayer").data("kendoMediaPlayer");
        mediaPlayer.one("play", function(){
          mediaPlayer.seek(50000);
        });

      });
    </script>

See Also

In this article
Not finding the help you need? Improve this article