Convert Html5 video time to hours, minutes and seconds - Javascript

Asked

Viewed 343 times

1

I need a little help, I’m new here and I’m trying to create a custom video player, only I’m having a hard time in the time part, and I wanted someone to help me do just that, if possible, by demarcating and explaining a little bit, just wanted to know how to convert the video time to give a "span" in hours, minutes and seconds, at the moment the only basis I have is this (well little kk):

  • 1

    Welcome home, you could edit your question and put the code of what you have tried to do ?

  • it is possible to do this with a javascript Mácara/filter, several frameworks offer this.

1 answer

1

A simple example with Angularjs

<html ng-app="helloWorld">
<head>
    <title>Hello World</title>
    <!-- Biblioteca AngularJS -->
    <script src="angular.js"></script>
    <script>
        angular.module("helloWorld", []);
        angular.module("helloWorld").controller("helloWorldCtrl", function ($scope) {
            <!-- Para teste usei o new Date() para pegar a data atual -->
            $scope.message = new Date();
        });
    </script>
</head>
<body>
    <div ng-controller="helloWorldCtrl">
        <!-- variável | máscara -->
        {{message | date: 'hh:mm:ss'}}
    </div>
</body>
</html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.