9 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
basically, if a video has audio, we want to show an indicator that our users might want to enable it if a video is autoplaying
looks like we might be able to figure this out when/before the user uploads the video, but it's the kind of thing that could make sense to have in the video details response - but perhaps only for us 🙂
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
sweet!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Example of handling this client-side — players like hls.js typically expose an API to allow you to query what audio tracks are available for a given video:
https://github.com/video-dev/hls.js/blob/master/docs/API.md#hlsaudiotracks
GitHub
hls.js/API.md at master · video-dev/hls.js
HLS.js is a JavaScript library that plays HLS in browsers with support for MSE. - hls.js/API.md at master · video-dev/hls.js
we're using hls.js, and ideally we want to know whether or not a video has audio before loading it
we are able to work around this by having our editors - who’s uploading the video - check this client side and just tell us, but as with most other things we prefer not having to trust the client, although it’s a pretty safe thing for us to do in this case
Why do you need to know before requesting the manifest file? What problem are you trying to solve?
As you know, playing videos with audio enabled in the browser requires a user action, and the way we structure our pages/stories is from a single JSON-file containing all the data needed about everything happening on the page, so if we know a Video somewhere further down has audio, we might want to prompt the user to enable it before we even begin loading it way earlier on the site