Closed ghost closed 10 months ago
Is somebody using HLS streaming with byte range requests and got it working ?
A default example on the VHS demo page is a byte-range example
https://videojs-http-streaming.netlify.app/
Here is the code where vhs attaches range headers if byte-range is presented: https://github.com/videojs/http-streaming/blob/719b7f44d9608de9774aa8f0f56679fd9342501c/src/media-segment-request.js#L1027
and here is the actual code of the function: https://github.com/videojs/http-streaming/blob/719b7f44d9608de9774aa8f0f56679fd9342501c/src/xhr.js#L176
Hey! We've detected some video files in a comment on this issue. If you'd like to permanently archive these videos and tie them to this project, a maintainer of the project can reply to this issue with the following commands:
@video-archivist-bot save 0j2MyE
@dzianis-dashkevich I noticed that this is a transport stream (.ts file), but I'm using fragmented mp4 (fmp4/m4s), could this be the issue here? I also noticed that there is not #EXT-X-VERSION Tag or #EXT-X-PLAYLIST-TYPE at the Playlist you mentioned. Can you maybe explain a bit more what the issue is here with my playlist setup? I don't fully understand what triggers the byte range requests using VideoJS.
Please also see:
### HLS Missing Features
->
* Use of [EXT-X-MAP] with [TS] segments
* [EXT-X-MAP] is currently supported for [MP4] segments, but not yet for TS
So is this now missing or not? The statement is kinda strange as it's part of the missing features section.
Thanks in advance!
I noticed that this is a transport stream (.ts file), but I'm using fragmented mp4 (fmp4/m4s), could this be the issue here?
It should not be a problem.
I also noticed that there is not #EXT-X-VERSION Tag or #EXT-X-PLAYLIST-TYPE at the Playlist you mentioned.
It should not be a problem as well.
I don't fully understand what triggers the byte range requests using VideoJS
If the m3u8 parser returns a byte range for each segment, VHS should append range headers.
Can you maybe explain a bit more what the issue is here with my playlist setup?
I don't know what might be wrong with your audio-only playlist setup... You can deploy your playlist and provide a publicly available URL to test it on the VHS demo page.
So is this now missing or not? The statement is kinda strange as it's part of the missing features section.
This is probably outdated since vhs supports an initialization section for CMAF streams
you can check this example on the VHS demo page: https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_fmp4/master.m3u8
Hey! We've detected some video files in a comment on this issue. If you'd like to permanently archive these videos and tie them to this project, a maintainer of the project can reply to this issue with the following commands:
@video-archivist-bot save VEXXQE
Please give me some time, I will provide the data ASAP, thanks so far.
@dzianis-dashkevich You were indeed right, the HLS stream plays well using https://videojs-http-streaming.netlify.app, but I don't understand why it's not working with my setup here ... :( I'm using Angular together with VideoJS 7 and also the latest version of VHS (3.7.0). Is there anything special I have to activate with the player options ???
this.videoJsConfigObj = {
autoSetup: true,
fill: false,
controlBar: {
volumePanel: {
inline: false
},
fullscreenToggle: false,
},
autoplay: true,
disablePictureInPicture: true,
controls: true,
inactivityTimeout: 0,
fluid: true,
audioOnlyMode: true,
preferFullWindow: false,
preload: 'metadata',
techOrder: ['html5'],
html5: {
nativeControlsForTouch: true,
nativeAudioTracks: true,
nativeVideoTracks: true,
nativeTextTracks: true,
preloadTextTracks: false,
vhs: {
withCredentials: true,
overrideNative: false,
bandwidth: 1411000,
handlePartialData: true,
maxPlaylistRetries: 10,
fastQualityChange: true,
enableLowInitialPlaylist: false,
limitRenditionByPlayerDimensions: true,
useDevicePixelRatio: true,
experimentalBufferBasedABR: false,
handleManifestRedirects: true,
useNetworkInformationApi: false,
cacheEncryptionKeys: true,
manualCleanup: true,
},
}
}
}
At the package.json of my Angular application I have:
"@types/video.js": "^7.3.55",
"@videojs/http-streaming": "^3.7.0",
"video.js": "^7.21.5",
Thanks in advance
I found the offending line ... Which is kinda strange ...
I have the following at my VideoJS config:
videojs.Vhs.xhr.beforeRequest = (options: any) => {
options.headers = { Authorization: this.file_response.access_token }; ### < This appear to be evil here
options.withCredentials = true;
If I disable the JWT authorization against my media files and also remove
options.headers = { Authorization: this.file_response.access_token };
I have no problems at all playing the Media ... Any Idea? Actually I would expect that I can also send the JWT with every byte range request
To get byte-range requests working with an additional Authorization Header you should not overwrite the already existing headers as I did before, Instead we need to trick a bit around the request logic and simply append the Authorization like this:
videojs.Vhs.xhr.beforeRequest = (options: any) => {
if (!options.headers) {
options.headers = {}; // Ensure the headers object exists
}
// Add the Authorization header without overwriting existing headers
options.headers['Authorization'] = this.file_response.access_token;
return options;
};
Maybe it help somebody else ...
@dzianis-dashkevich Thanks again for your interest in with problem
For some reason byte range requests aren't working at all, VideoJS does simply not attach the Range header to the http request, where other player working perfectly fine with my streaming backend, I tested my config below using various players e.g. the bitmovin player works fine with my setup.
This is how my nginx location looks like:
Can please somebody explain to my what the problem is here? This is definitely a VideoJS problem, and not a problem on server side from my end.
This is how my playlist is structured:
And this is the actually referenced playlist of the Track:
But VideoJS does not use rage header in its request using this playlist setup. The only thing that is working for me is using independent segments, which is kinda annoying ...
Is somebody using HLS streaming with byte range requests and got it working ?