Button to skip html5 video to the end<button> vs. <input type=“button” />. Which to use?How can I know which radio button is selected via jQuery?jQuery disable/enable submit buttonStoring Objects in HTML5 localStorageChange an HTML5 input's placeholder color with CSSHow to create an HTML button that acts like a link?Are (non-void) self-closing tags valid in HTML5?Can I hide the HTML5 number input’s spin box?Using HTML5/Canvas/JavaScript to take in-browser screenshotsHTML5 video playing backward, detect “end” of video

When did Britain learn about American independence?

Do we see some Unsullied doing this in S08E05?

Polynomial division: Is this trick obvious?

Capital gains on stocks sold to take initial investment off the table

refer string as a field API name

How do Ctrl+C and Ctrl+V work?

Deleting the same lines from a list

​Cuban​ ​Primes

Why does Taylor’s series “work”?

Why is vowel phonology represented in a trapezoid instead of a square?

Why are there five extra turns in tournament Magic?

How can we delete item permanently without storing in Recycle Bin?

Would life always name the light from their sun "white"

Is there any deeper thematic meaning to the white horse that Arya finds in The Bells (S08E05)?

Is Precocious Apprentice enough for Mystic Theurge?

How come Arya Stark didn't burn in Game of Thrones Season 8 Episode 5

Is Big Ben visible from the British museum?

301 Redirects what does ([a-z]+)-(.*) and ([0-9]+)-(.*) mean

Why nobody knew who the Lord was?

What is this rubber on gear cables

Can EU citizens work on Iceland?

Why is it correct to use ~た in this sentence, even though we're talking about next week?

What dog breeds survive the apocalypse for generations?

Is it possible to pass a pointer to an operator as an argument like a pointer to a function?



Button to skip html5 video to the end


<button> vs. <input type=“button” />. Which to use?How can I know which radio button is selected via jQuery?jQuery disable/enable submit buttonStoring Objects in HTML5 localStorageChange an HTML5 input's placeholder color with CSSHow to create an HTML button that acts like a link?Are (non-void) self-closing tags valid in HTML5?Can I hide the HTML5 number input’s spin box?Using HTML5/Canvas/JavaScript to take in-browser screenshotsHTML5 video playing backward, detect “end” of video






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a video player which contain a skip button so that the user can skip the video to the end.



Here is html



<video id="video1" style="height: 100%" class="video-js vjs-default-skin" controls muted autoplay="true">
</video>


skip function



function skipVideoTime()
$('.skip_button').on('click', function ()
var vid = $("#video1")[0];
var vidDuration = Math.floor(vid.duration);
skipTime(vidDuration);
console.log(vidDuration);

)



function skipTime(time)
var vid = $("#video1")[0];
vid.play();
vid.pause();
vid.currentTime = time;
vid.play();
console.log(vid.duration);
;

$(function ()

skipVideoTime();


);


Here is console logs from the above functions



32.534



32



Now when I click the button it skip to 32 minutes because I used math floor function if I remove math floor so that it can skip to 32.534, it does not work,



what do I need to change to get what I want?










share|improve this question

















  • 2





    As far as I can guess, you are trying to seek the media / video at the end of its time. e.g. 32.534 sec. after that you are again calling play() function which I think will play the video again from start. Do you really need to call vid.play() after seeking the media till its duration ?

    – agpt
    Mar 23 at 16:38


















0















I have a video player which contain a skip button so that the user can skip the video to the end.



Here is html



<video id="video1" style="height: 100%" class="video-js vjs-default-skin" controls muted autoplay="true">
</video>


skip function



function skipVideoTime()
$('.skip_button').on('click', function ()
var vid = $("#video1")[0];
var vidDuration = Math.floor(vid.duration);
skipTime(vidDuration);
console.log(vidDuration);

)



function skipTime(time)
var vid = $("#video1")[0];
vid.play();
vid.pause();
vid.currentTime = time;
vid.play();
console.log(vid.duration);
;

$(function ()

skipVideoTime();


);


Here is console logs from the above functions



32.534



32



Now when I click the button it skip to 32 minutes because I used math floor function if I remove math floor so that it can skip to 32.534, it does not work,



what do I need to change to get what I want?










share|improve this question

















  • 2





    As far as I can guess, you are trying to seek the media / video at the end of its time. e.g. 32.534 sec. after that you are again calling play() function which I think will play the video again from start. Do you really need to call vid.play() after seeking the media till its duration ?

    – agpt
    Mar 23 at 16:38














0












0








0








I have a video player which contain a skip button so that the user can skip the video to the end.



Here is html



<video id="video1" style="height: 100%" class="video-js vjs-default-skin" controls muted autoplay="true">
</video>


skip function



function skipVideoTime()
$('.skip_button').on('click', function ()
var vid = $("#video1")[0];
var vidDuration = Math.floor(vid.duration);
skipTime(vidDuration);
console.log(vidDuration);

)



function skipTime(time)
var vid = $("#video1")[0];
vid.play();
vid.pause();
vid.currentTime = time;
vid.play();
console.log(vid.duration);
;

$(function ()

skipVideoTime();


);


Here is console logs from the above functions



32.534



32



Now when I click the button it skip to 32 minutes because I used math floor function if I remove math floor so that it can skip to 32.534, it does not work,



what do I need to change to get what I want?










share|improve this question














I have a video player which contain a skip button so that the user can skip the video to the end.



Here is html



<video id="video1" style="height: 100%" class="video-js vjs-default-skin" controls muted autoplay="true">
</video>


skip function



function skipVideoTime()
$('.skip_button').on('click', function ()
var vid = $("#video1")[0];
var vidDuration = Math.floor(vid.duration);
skipTime(vidDuration);
console.log(vidDuration);

)



function skipTime(time)
var vid = $("#video1")[0];
vid.play();
vid.pause();
vid.currentTime = time;
vid.play();
console.log(vid.duration);
;

$(function ()

skipVideoTime();


);


Here is console logs from the above functions



32.534



32



Now when I click the button it skip to 32 minutes because I used math floor function if I remove math floor so that it can skip to 32.534, it does not work,



what do I need to change to get what I want?







javascript jquery html html5






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 16:19









user9964622user9964622

1,35021846




1,35021846







  • 2





    As far as I can guess, you are trying to seek the media / video at the end of its time. e.g. 32.534 sec. after that you are again calling play() function which I think will play the video again from start. Do you really need to call vid.play() after seeking the media till its duration ?

    – agpt
    Mar 23 at 16:38













  • 2





    As far as I can guess, you are trying to seek the media / video at the end of its time. e.g. 32.534 sec. after that you are again calling play() function which I think will play the video again from start. Do you really need to call vid.play() after seeking the media till its duration ?

    – agpt
    Mar 23 at 16:38








2




2





As far as I can guess, you are trying to seek the media / video at the end of its time. e.g. 32.534 sec. after that you are again calling play() function which I think will play the video again from start. Do you really need to call vid.play() after seeking the media till its duration ?

– agpt
Mar 23 at 16:38






As far as I can guess, you are trying to seek the media / video at the end of its time. e.g. 32.534 sec. after that you are again calling play() function which I think will play the video again from start. Do you really need to call vid.play() after seeking the media till its duration ?

– agpt
Mar 23 at 16:38













1 Answer
1






active

oldest

votes


















2














I believe you don't need to call the play() function again. because once media is seeked to the end (till its total duration), calling play() will do nothing but run the video again from beginning. Have a look at following code snippet.






var video = document.getElementById("myvid");
var button = document.getElementById("button");

button.addEventListener("click", function(e)
console.log(video.duration);
video.play();
video.pause();
video.currentTime = video.duration;
// video.play();
)

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>

<video src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" controls id="myvid"></video>
<button id="button">skip</button>
</body>
</html>








share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315815%2fbutton-to-skip-html5-video-to-the-end%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    I believe you don't need to call the play() function again. because once media is seeked to the end (till its total duration), calling play() will do nothing but run the video again from beginning. Have a look at following code snippet.






    var video = document.getElementById("myvid");
    var button = document.getElementById("button");

    button.addEventListener("click", function(e)
    console.log(video.duration);
    video.play();
    video.pause();
    video.currentTime = video.duration;
    // video.play();
    )

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    </head>
    <body>

    <video src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" controls id="myvid"></video>
    <button id="button">skip</button>
    </body>
    </html>








    share|improve this answer



























      2














      I believe you don't need to call the play() function again. because once media is seeked to the end (till its total duration), calling play() will do nothing but run the video again from beginning. Have a look at following code snippet.






      var video = document.getElementById("myvid");
      var button = document.getElementById("button");

      button.addEventListener("click", function(e)
      console.log(video.duration);
      video.play();
      video.pause();
      video.currentTime = video.duration;
      // video.play();
      )

      <!DOCTYPE html>
      <html>
      <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width">
      </head>
      <body>

      <video src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" controls id="myvid"></video>
      <button id="button">skip</button>
      </body>
      </html>








      share|improve this answer

























        2












        2








        2







        I believe you don't need to call the play() function again. because once media is seeked to the end (till its total duration), calling play() will do nothing but run the video again from beginning. Have a look at following code snippet.






        var video = document.getElementById("myvid");
        var button = document.getElementById("button");

        button.addEventListener("click", function(e)
        console.log(video.duration);
        video.play();
        video.pause();
        video.currentTime = video.duration;
        // video.play();
        )

        <!DOCTYPE html>
        <html>
        <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        </head>
        <body>

        <video src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" controls id="myvid"></video>
        <button id="button">skip</button>
        </body>
        </html>








        share|improve this answer













        I believe you don't need to call the play() function again. because once media is seeked to the end (till its total duration), calling play() will do nothing but run the video again from beginning. Have a look at following code snippet.






        var video = document.getElementById("myvid");
        var button = document.getElementById("button");

        button.addEventListener("click", function(e)
        console.log(video.duration);
        video.play();
        video.pause();
        video.currentTime = video.duration;
        // video.play();
        )

        <!DOCTYPE html>
        <html>
        <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        </head>
        <body>

        <video src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" controls id="myvid"></video>
        <button id="button">skip</button>
        </body>
        </html>








        var video = document.getElementById("myvid");
        var button = document.getElementById("button");

        button.addEventListener("click", function(e)
        console.log(video.duration);
        video.play();
        video.pause();
        video.currentTime = video.duration;
        // video.play();
        )

        <!DOCTYPE html>
        <html>
        <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        </head>
        <body>

        <video src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" controls id="myvid"></video>
        <button id="button">skip</button>
        </body>
        </html>





        var video = document.getElementById("myvid");
        var button = document.getElementById("button");

        button.addEventListener("click", function(e)
        console.log(video.duration);
        video.play();
        video.pause();
        video.currentTime = video.duration;
        // video.play();
        )

        <!DOCTYPE html>
        <html>
        <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        </head>
        <body>

        <video src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" controls id="myvid"></video>
        <button id="button">skip</button>
        </body>
        </html>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 at 16:41









        agptagpt

        3,00483978




        3,00483978





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315815%2fbutton-to-skip-html5-video-to-the-end%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해