Issue with Videogular: hh:mm:ss Date filter not functioning properly

I am currently working on integrating Videogular into my audio player application. Below are the settings provided in the example code on this particular page:

      <vg-time-display>{{ currentTime | date:'mm:ss' }}</vg-time-display>
      <vg-scrub-bar>
        <vg-scrub-bar-current-time></vg-scrub-bar-current-time>
      </vg-scrub-bar>
      <vg-time-display>{{ timeLeft | date:'mm:ss' }}</vg-time-display>

However, I am dealing with audio files that exceed one hour in length, thus requiring a format of "hh:mm:ss". When I attempt to change the format to hh:mm:ss, it mistakenly adds approximately 5 hours to the duration, resulting in 00:01:30 being displayed as 05:01:30.

After some trial and error, I discovered making the following adjustment within "videogular.js" resolves the issue:

this.onUpdateTime = function (event) {
  $scope.API.currentTime = 1000 * event.target.currentTime - (1000 * 60 * 300 * 5 * 5);

  if (event.target.duration != Infinity) {
    $scope.API.totalTime = 1000 * event.target.duration - (1000 * 60 * 300 * 5 * 5);
    $scope.API.timeLeft = 1000 * (event.target.duration - event.target.currentTime) - (1000 * 60 * 300 * 5 * 5);
    $scope.API.isLive = false;
  }
}

Unfortunately, this modification also impacts the subsequent code which I have been unable to rectify:

  percentTime = 100 * (newCurrentTime / API.totalTime);
  elem.css("width", percentTime + "%");

Answer №1

It seems like the issue lies more in the limitations of the AngularJS filter rather than a problem with Videogular. The AngularJS date filter, as per the AngularJS documentation, only supports the browser timezone or UTC.

https://docs.angularjs.org/api/ng/filter/date

If you need to display hours, I suggest creating your own custom filter to show hours instead of using date:'mm:ss'.

Considering this could be a beneficial feature for Videogular, I will investigate the AngularJS code to potentially add full timezone support.

Answer №2

It appears to be functioning properly when specifying the timezone "+0000" as the second parameter for the date filter:

<vg-time-display>{{ currentTime | date:'HH:mm:ss':'+0000' }}</vg-time-display>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Maintain the markup created by jQuery inside the AJAX function called by setInterval

In the code snippet below, real-time markup is generated and automatically updates using the setInterval function. The markup includes buttons and hidden content within div elements. Each button reveals its corresponding div, but the div reverts to a hid ...

How can I resize an element using jQuery resizable and then revert it back to its original size with a button click?

I need help figuring out how to revert an element back to its original size after it has been modified with .resizable. I attempted the following: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="//code. ...

Browser Compatibility with AngularJS

Encountering an issue with AngularJS compatibility - are there any features not supported by Google Chrome? We have developed the AngularUI Calendar and utilized the JSFiddle link below: http://jsfiddle.net/joshkurz/xqjtw/52/ The UI calendar works on Fi ...

Error encountered: Unspecified "from" address in the provided or default options

Seeking guidance on a project related to Ethereum and Solidity, part of Udemy's course titled "Ethereum and Solidity: The Complete Developers Guide." I am currently working on building the front-end for a Kickstarter alternative. I am facing an issue ...

Enhancing Security in the apex.server.process Function in Oracle APEX

Once we have disabled a button using client-side JavaScript, our goal is to initiate an Ajax call to create a record in a database table through an On-Demand Process. However, there is a concern that users could bypass this process by making similar calls ...

What is the best way to assign a unique number to every div id that is generated?

I am currently using a django for loop to retrieve data from a query set. As the information is displayed, I would like to have each item wrapped in a div tag with a unique id that increments by 1 for every instance. Is there a way to achieve this directly ...

JavaScript API Response - conditional statement for handling a 'null' response

Does anyone have any suggestions for the following scenario: I have a response in .json format containing personal data of a person, who may or may not be assigned to a project. Here is an example response where the person is not assigned to a project: & ...

Transform Django Model Instance from Serialized Back to Object using Ajax

Currently, I'm utilizing Ajax to search for a model instance. Once found, I return that instance and pass it as a variable to a template tag within my template. To achieve this, in my view, I serialize the object before sending it to the Ajax success ...

Module specifier "vue" could not be resolved due to an uncaught TypeError. Remember that relative module specifiers must always begin with "./", "../" or "/"

Looking to create the most basic vuejs Hello World application using separate files. Here is the project setup: start by creating index.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> ...

Enhancing Material UI v4 Themes using TypeScript

I am attempting to implement my own custom palette option in the theme section, but I am struggling with how to do the augmentation part using TypeScript. So far, I have created a file named "material-ui.d.ts" and inside it, I only have: import { PaletteO ...

Encountering Typescript errors when trying to destructure a forEach loop from the output of

There are different types categorized based on mimetypes that I am currently working with. export type MimeType = 'image' | 'application' | 'text'; export type ApplicationMimeType = '.pdf' | '.zip'; expor ...

Analyzing data visualization within CSS styling

I have the desire to create something similar to this, but I am unsure of where to start. Although I have a concept in mind, I am struggling to make it functional and visually appealing. <div id="data"> <div id="men" class="shape"></di ...

The fitBounds and panToBounds functions in react-google-maps fail to properly adjust the map's size

const Map = withGoogleMap(props => { const { activeMarker, zoom, center, showInfoWindow, products } = props; const [selectedPlace, setSelectedPlace] = useState(null); // Code to iterate through items and adjust map size, center, and zoom to inclu ...

Error: The URI you are trying to access is restricted and access has been denied

I'm facing an issue with my HTML file that contains multiple d3-graphs embedded directly within script tags. When I try to move one of the graphs to an external JavaScript file, I receive the following error message: "NS_ERROR_DOM_BAD_URI: Access to r ...

Creating a personalized tab label in Angular Material's md-tabs

After reading the md-tab Documentation, it seems that custom md-tab-label can be created. I attempted to achieve this as follows: <md-tab-label class="my-label"> Label </md-tab-label> Here is my CSS: .my-label{ background: #40FF00; } ...

I am unable to eliminate the parentheses from the URL

I am in need of creating a function that can extract the content inside "()"" from a URL: Despite my efforts, the function I attempted to use did not provide the desired result. Instead of removing the "()" as intended, it encoded the URL into this format ...

how to combine a string in JavaScript using a prefix and suffix

Anion Gap Body Surface Area (BSA) Creatinine Clearance Stack Overflow i want to add "String" Before Text and "String" after end of text. I have Following expression which runs perfectly in excel:- =CONCATENATE("",B1,"") Output:- <string>Anion Ga ...

Best practices for handling forEach AJAX requests in Angular

I am looking to update the data for each object in an array using a for loop and then run a function once all the data is captured, without incorporating jQuery. I want to follow the correct Angular approach. This is what I have implemented: $scope. ...

Tips for creating CSS styles for a selected input field

I seem to be stuck in a situation where my screen looks similar to the screenshot provided. There are four input elements that I would like to have bordered just like in the image, complete with a circled tick mark. I've managed to create these four i ...

Navigating by Typing in the URL Bar in React

Whenever I paste a valid URL and press enter, the useEffect function in the parent component does not get triggered. However, if I reload the page, it works fine. Here is the code snippet: Routing path <Route path="/search" element={<Searc ...