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

getting buffer levels #1617

Closed
krvangala opened this issue Oct 15, 2018 · 5 comments
Closed

getting buffer levels #1617

krvangala opened this issue Oct 15, 2018 · 5 comments
Labels
status: archived Archived and locked; will not be updated type: question A question from the community

Comments

@krvangala
Copy link

Have you read the FAQ and checked for duplicate open issues?:
Yes
What version of Shaka Player are you using?:
2.4.2
Can you reproduce the issue with our latest release version?:
NA
Can you reproduce the issue with the latest code from master?:
NA
Are you using the demo app or your own custom app?:
NA
If custom app, can you reproduce the issue using our demo app?:
NA
What browser and OS are you using?:
Linux Chrome
What are the manifest and license server URIs?:

NA
What did you do?

What did you expect to happen?
NA
What actually happened?
NA

Hi,
what is the best way get audio and video buffer levels?.
what is the best place i can add a hook or fir an event when buffer level changed like buffer added or removed.
Thanks
Krishna

@vaage vaage added type: question A question from the community and removed needs triage labels Oct 15, 2018
@vaage
Copy link
Contributor

vaage commented Oct 15, 2018

@krvangala Could you elaborate on what you are looking to do? We will be able to provide more specific guidance if you know what use case you are looking to implement as I am not clear on some of the terms you are using (e.g. "buffer level").

Here is a board explanation of what is happening in Shaka Player:

  1. ABR Manager picks which streams should be streamed based on the current network bandwidth by telling Streaming Engine what streams to download.
  2. Streaming Engine fetches segments using NetworkingEngine and pushes them to Media Source Engine.
  3. Media Source Engine manages Media Source and appends and removes buffers from Media Source.

@vaage vaage added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Oct 15, 2018
@chrisfillmore
Copy link
Contributor

@krvangala If you are asking about how much video is buffered at any given moment, you can obtain this information from the video element:

// Get your video element
const videoElement = document.querySelector('video');

// This is a TimeRanges object, see: https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges
const buffered = videoElement.buffered;

// There could be multiple buffered ranges, so you will need to find the one you want.
for (let i = 0; i < buffered.length; i++) {
  console.log(buffered.start(i), buffered.end(i));
}

Let me know if this is useful to you.

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Oct 15, 2018
@krvangala
Copy link
Author

Hi @vaage and @chrisfillmore thanks for reply.

buffer level here means, buffer level (time ranges) in Media source ( video or audio).
We have deployed our player( uses Shaka 2.4.2) on field. Would like collect buffer levels of audio and video in Media Source.
looks like shaka.Player.prototype.getBufferedInfo will serve the purpose.
Thanks
Krishna

@vaage
Copy link
Contributor

vaage commented Oct 15, 2018

@krvangala I am glad you found what will work for you. I am going to close the issue.

@vaage vaage closed this as completed Oct 15, 2018
@joeyparrish
Copy link
Member

The buffered member of the video element is the intersection of audio and video buffer levels. If you want a breakdown, use player.getBufferedInfo(). This will show you video, audio, text, and "total" (intersection of audio and video as reported by video element).

https://shaka-player-demo.appspot.com/docs/api/shaka.Player.html

Hope that helps!

@shaka-project shaka-project locked and limited conversation to collaborators Dec 14, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
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 type: question A question from the community
Projects
None yet
Development

No branches or pull requests

5 participants