Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8220915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:43:05+00:00 2026-06-07T13:43:05+00:00

I am working on an application with HTML5 video where I have to display

  • 0

I am working on an application with HTML5 video where I have to display the current time of the video tag of my page in a seperate label.

I tried to define a property in my view which returns the formatted time of the video, something like

videoCounter: function() {
    return App.seconds2String(Math.floor(App.getCurrentVideoTime() + 0.5));
}.property().volatile()

which returns the current time of the video as mm:ss.

The function App.getCurrentVideoTime() gets the current time from the video element in the page (so it is not an Ember property and therefore an not be bound) like this:

getCurrentVideoTime: function() {
    var videoElement = document.getElementById('video');
    if (videoElement) {
        return Math.round(videoElement.currentTime * 10) / 10;
    }
    else {
        return 0;
    }
}

The handlebars view contains

<label id="videoCounter">{{view.videoCounter}}</label>

Unfortunately the value is not updated as the video plays, i. e. it displays 00:00 all the time.

How can i trigger an update for the computed property that is only dependent on the current time of the video tag?

I don’t need high accuracy, the timer should only show the current time of the video in seconds.

Any ideas?

Thank you so much!

Thomas

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:43:06+00:00Added an answer on June 7, 2026 at 1:43 pm

    It’s not obvious from the code you’ve stated whether you are using a custom view, but I would create a custom Video view and bind to the timeupdate event, see http://jsfiddle.net/pangratz666/fzNMb/:

    Handlebars:

    <script type="text/x-handlebars" >
        {{view App.Video width="400px" controllerBinding="App.videoController"}}
        {{App.videoController.currentTimeFormatted}}
    </script>​
    

    JavaScript:

    App.Video = Ember.View.extend({
        srcBinding: 'controller.src',
        controls: true,
        tagName: 'video',
        attributeBindings: 'src controls width height'.w(),
    
        didInsertElement: function() {
            this.$().on("timeupdate", {
                element: this
            }, this.timeupdateDidChange);
        },
    
        timeupdateDidChange: function(evt) {
            var video = evt.data.element;
            var currentTime = evt.target.currentTime;
            video.setPath('controller.currentTime', currentTime);
        }
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Mobile HTML5 Application. I have a field of type=number
I'm working on an html5 application built on CouchDB. I want to make sure
I am working on an application with many html pages. I have created these
I have an working application. Now I want to change the table names of
I have a working application using python and zeromq and I would like to
A HTML5 video I am implementing is not working in Internet Explorer 9. After
I'm working on an HTML5 mobile app and I initially have the background of
I am working on a HTML5 application designed to run a Google map which
HTML5 Application Cache not working in ie8+, so i need some of the solution
I'm working on an HTML5-based web application that will make use of a local

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.