videogular / videogular2

The HTML5 video player for Angular 2
https://videogular.github.io/videogular2-showroom/#/
MIT License
672 stars 210 forks source link

HLS Directive does not report "isLive" correctly #740

Open kwarismian opened 6 years ago

kwarismian commented 6 years ago

Description

HLS Live Manifests (an m3u8 without an X-EndList) are constructed with a sliding window of time, so the reported "total time" is not infinity, causing the "isLive" check inside the Media object to report false.

Expected Behavior

isLive should be triggered when HLS is live so that controls behave as expected.

Actual Behavior

Rather than showing "Live" for the total time, it will show an ever changing sequence of numbers as segments are added, parsed, and removed from the sliding window.

Steps to Reproduce

  1. Set up a player with the [vgHls] directive
  2. Play video
  3. Notice that there is an ever changing total time
  4. Weep, gnash teeth, and assume the fetal position as you question all of your life decisions

Pull request resolving this issue is imminent.

Elecash commented 6 years ago

Thank you @kwarismian !!

I'm happy to review the PR!

Elecash commented 6 years ago

@kwarismian btw, I would say that this worked at some point but maybe not with all the HLS live sources.

Definitely to set up isLive via the VgAPI should be way better than what I'm doing now tho.

kwarismian commented 6 years ago

I was reaching straight into the media object and setting it in reaction to the Hls.Events.LEVEL_LOADED event. Would you rather I create a method in vgAPI to proxy the request through to the media object?

Within onPlayerReady:

           this.hls.on(
                Hls.Events.LEVEL_LOADED,
                (event, data) => {
                    this.target.isLive = data.details.live;
                }
            );

I can certainly make changes to move the setting logic into vgAPI (does not currently expose isLive directly) before sending the pull request if that is your preference. I will go ahead and get it sent through, then we can discuss it in the PR.

carrbrpoa commented 6 years ago

@kwarismian since the PR is not concluded, what do I need to import to have that this.hls available in my code? I just wish to set HLS to live.