Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for cuechange events in HLS playback #2476

Merged
merged 6 commits into from
Apr 27, 2020

Conversation

avelad
Copy link
Member

@avelad avelad commented Mar 30, 2020

Resolves #1917

@avelad
Copy link
Member Author

avelad commented Apr 1, 2020

@ismena Can you check if everything is correct? Thanks!

@ismena
Copy link
Contributor

ismena commented Apr 1, 2020

Can you explain the use case for me a little?
When does this event fire, what is it for, and how do we use it?

@avelad
Copy link
Member Author

avelad commented Apr 1, 2020

This change simplifies SS logic, just as it has done for DASH regions. On the other hand I have seen that there was an issue that asked to launch an event when there was a change of cues, I have been reviewing our internal logic and we also used it to obtain certain metadata from other streams.

@ismena
Copy link
Contributor

ismena commented Apr 1, 2020

This is different from the CUEPOINTS_CHANGED event, right? What are the cues in this case?

@avelad
Copy link
Member Author

avelad commented Apr 1, 2020

@ismena
Copy link
Contributor

ismena commented Apr 2, 2020

Oh, I see. What format is the hls metadata in? Ideally we'd want to convert hls and dash metadata to the same internal format and then to the ad manager that should be agnostic of whether it came from hls or dash. Can we come up with a common format for the timed region and whatever format hls' stuff is in?

@avelad
Copy link
Member Author

avelad commented Apr 3, 2020

For HLS is key/value, but in DASH is another world. Each our providers has a specific format in the region.

@ismena
Copy link
Contributor

ismena commented Apr 3, 2020

Ok, in that case let's proceed with this solution for now to unblock you, I'll see if we can find a common denominator later.
Last question, is it possible to write a unit test for this?

@avelad
Copy link
Member Author

avelad commented Apr 3, 2020

Yes, but until next week it is not possible.

@ismena
Copy link
Contributor

ismena commented Apr 3, 2020

That's fine. Let me run the build bot to see if there are any build issues now. I have some testing stuff for ads in code review now, I'll try to get it checked in by next week and hopefully it will make it easier for you to write a test for this next week.

@avelad
Copy link
Member Author

avelad commented Apr 3, 2020

Ok, I'll wait for that to go up to merge the changes and write the test. Thanks!

@shaka-bot
Copy link
Collaborator

All tests passed!

@ismena
Copy link
Contributor

ismena commented Apr 7, 2020

Alright, the initial test suit has been checked in: test/ads/ad_manager_unit.js. Feel free to add your test there, if it fits.

@avelad
Copy link
Member Author

avelad commented Apr 8, 2020

@ismena

I was wrong :( I found a spec for this https://github.com/WICG/datacue/blob/master/explainer.md and applies to DASH and HLS.

I think that It's better not to merge this PR and create in a future a valid solution to both.

@ismena
Copy link
Contributor

ismena commented Apr 8, 2020

@avelad
I think you have a typo, but I'm not sure which way it goes :)
Was it "I think it's better TO merge this PR" or "I think it's better NOT TO merge this PR?" :))

Ideally, I'd put this on hold and work on a common solution, but if you need this in 2.6, I'll work with you.

@avelad
Copy link
Member Author

avelad commented Apr 8, 2020

Sorry, I updated the comment. I think that I can work in the full specification of HLS and partially in DASH in 3-4 weeks. It’s not necessary in 2.6. If you have any recommendation about the design, any idea is welcome.

@avelad
Copy link
Member Author

avelad commented Apr 8, 2020

Another option is remove the part of expose the new event and kept the SS logic, what do you think?

@ismena
Copy link
Contributor

ismena commented Apr 8, 2020

I'm not sure I understand the suggestion in the last comment. Why don't you start with a short design proposal(s) once you're ready to look into it?

I'll also see if I can look at it in the next few weeks. If I swing it, I'll have some design thoughts for you before you start, otherwise, we'll work on it together once you get to it.

@avelad
Copy link
Member Author

avelad commented Apr 8, 2020

Ok, I will work on a design proposal. Until Tuesday I will not be able to start working, it is Easter holidays, but we will be confined at home also due to the covid-19 :)

@ismena
Copy link
Contributor

ismena commented Apr 8, 2020

@avelad Have a great stay-at-home holiday :)
Do I remember correctly that you're from Spain?
We're all locked at home as well. :)

@avelad
Copy link
Member Author

avelad commented Apr 13, 2020

I think this would be the API proposal:

/**

  • @event shaka.Player.MetadataEvent
  • @description Fired when a metadata is found
  • @Property {string} type
  • 'metadata'
  • @Property {number} startTime
  • The time that describes the beginning of the range of the metadata to
  • which the cue applies.
  • @Property {number} endTime
  • The time that describes the end of the range of the metadata to which
  • the cue applies.
  • @Property {Object} value
  • All metadata associated.
  • @Property {string} type
  • The metadata type.
  • @exportDoc
    */

ValueObject = {
key (string)
data (string|number|array|arraybuffer|object)
}

Enum for type property:

  • org.mp4ra
  • org.id3
  • How map DASH events?

For native playback we can get the info from cuechange event
For TS playback with mux.js we need read ID3 metadata with https://github.com/videojs/mux.js#metadata
For MP4/WebM I don't know how to proceed, Any idea?

@avelad
Copy link
Member Author

avelad commented Apr 13, 2020

Metadata example of mux.js
Captura de pantalla 2020-04-13 a las 17 06 09
(URL: https://vcloud.blueframetech.com/file/hls/13836.m3u8 )

@ismena this is necessary for DAI (SS) when you are using HLS-TS in Chrome for example. Have you take into account?

@ismena
Copy link
Contributor

ismena commented Apr 13, 2020

@avelad
Thanks for the proposal!
I'm a bit busy with other stuff this week, but I will do some research and comment/add to the design next week.

@avelad
Copy link
Member Author

avelad commented Apr 27, 2020

I have updated the PR with the master branch changes. I have also simplified the logic and at the moment I think it would serve what I wanted to solve this PR (see the issue #1917)

@ismena , What do you think?

lib/player.js Outdated Show resolved Hide resolved
@@ -2125,6 +2146,14 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
track.mode = 'hidden';
this.eventManager_.listen(track, 'cuechange', () => {
for (const cue of track.activeCues) {
const eventName = shaka.Player.EventName.Metadata;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, is this whole method only applicable to Safari or is it gonna work for all the browsers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now only Safari, but it will work in all browsers, mux.js exposes the ID3 metadata but it is still not handled in the app.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Is it related to this PR or is that separate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That PR is the base, but you still have to process the data and expose it to the SS and launch the metadata event. I had planned to work on this soon, but I have two more urgent PR for this week according to our needs.

@ismena
Copy link
Contributor

ismena commented Apr 27, 2020

Looks good, running the buildbot now.

@shaka-bot
Copy link
Collaborator

All tests passed!

@ismena ismena merged commit 1e3e9f4 into shaka-project:master Apr 27, 2020
@ismena
Copy link
Contributor

ismena commented Apr 27, 2020

Thanks, merged!

@avelad avelad deleted the cuechange-events-hls branch April 28, 2020 06:01
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for cuechange events in HLS playback via src=
3 participants