m3u8 stream playback issue on Chrome (Windows and macOS)
When trying to playback video stream with VideoJS in Chrome on Mac, first 6 seconds are choppy and laggy. That issue doesn't happen on Firefox or Safari, only Chrome.
Stream URL: https://spotteu01tstmedia01.streaming.mediaservices.windows.net/faa5c3f5-d198-40df-aeb8-7ccfb4edf5a2//20190228095812-af71f790-7f3d-488.ism/manifest(format=m3u8-aapl-v3)
When I paste that stream url here, its working correctly: https://videojs.github.io/videojs-contrib-hls/ But when I try to play it here, first 6 seconds are choppy: https://videojs.github.io/http-streaming/
Video example: https://d.pr/v/kFgXsI
I'm running VideoJS 7.4.1 without videojs-contrib-hls because as far as I know its already included in VideoJS 7 or I'm wrong ?
I have an update on this. Same issue happens with dash format as well.
Steps to reproduce: visit page: https://videojs.github.io/http-streaming/ paste video url: https://spotteu01tstmedia01.streaming.mediaservices.windows.net/faa5c3f5-d198-40df-aeb8-7ccfb4edf5a2//20190228095812-af71f790-7f3d-488.ism/manifest(format=mpd-time-csf) change mime type to application/dash+xml
Any ideas?
After giving it thorough investigation, I've managed to find the reason why this stuttering happens. I have reproduced it on Chrome on Windows as well, so this issue is not isolated to macOS only.
If preload is 'auto' or 'metadata' to be more precise (and autoplay is false), when video is loaded it loads first few frames by loading the first fragment with video=0 (timestamp). When you click play, the same fragment (with video=0) gets downloaded, and for some reason it crashes the playback on Chrome until next fragment is played (in my case video=60000000, which is equivalent to 6 seconds).
One workaround is to set preload to 'none', but then I loose ability to display first frame (poster) on videos that aren't played automatically.
Can anyone please confirm whether this is a correct behavior and can if it be fixed easily? I don't understand the codebase in order to make fix myself.
Steps to reproduce:
- Click here using Chrome to open videojs.github.io/http-streaming/
- Open dev tools with network tab
- Paste this url
- click "Load" and then play video afterwards, video=0 is loaded twice where second loading crashes the playback
Screenshot:

For some reason I found that this hack fixes this issue, I don't know why, and I don't know what am I breaking with it, but it works:
player.on('ready', function() {
player.vhs = null;
});
It can be reproduced on https://videojs.github.io/http-streaming/ as well by typing player.vhs = null in console AFTER loading a video (but before clicking play).
Huh, that's weird. I wonder if VHS isn't getting cleaned up properly during source changes and that's causing some issues.
Interesting thing I noticed is that if you wait a bit after loading the stream, it plays back fine. It only has issues if you play back immediately.
yeah you are right, if I wait like a minute and then click play - it plays it fine ... strange ...
Running into the same issue on Linux with Chrome and VideoJS 7.4.1
@benweidig might be totally unrelated, but are you hosting your streams on Azure as well or somewhere else ?
@turshija no, we're hosting it on bare-metal machines from Hetzner with https://github.com/kaltura/nginx-vod-module for generating the streams.
We've got a few other similar reports, we'll need to investigate.
I am getting the same issue - for me, I get no video (or maybe one frame?) for 5-6 seconds and then playback works fine on Chrome. On IE11, I get only the first 5-6 seconds of video and then it freezes.
The 'vhs=null' fix does work for Chrome, but not IE11. I currently have this issue worked around by using a poster and preload=none, which seems to work perfectly.
My videos are being hosted in Azure Media Services, and I am using them for encoding as well.
Just to add to this we are seeing the same issue on all our videos in Chrome and we are hosting on AWS.
preload: none
Works but not sure what impact it will have other setups like progressive streaming
I've tested preload: none, using a high res poster image, and have experienced no add-on issues. I implemented a bunch of formats, including progressive mp4 streams, and haven't run into any users that can't stream.
Thanks @BillCarlson
Just to add to this we are seeing the same issue on all our videos in Chrome and we are hosting on AWS.
preload: none
Works but not sure what impact it will have other setups like progressive streaming
Thank you~
+1 having same issue on Chrome using videojs 7.5.4.
preload=none works for the first time but if video is in the loop, we get the same issue on second run.
I was able to fix the issue like this :
Rename <video> tag with <video-js> and initialize videojs like this :
var player = videojs('my-video', {
html5: {
hls: {
overrideNative: true
}
}
});
Example :
<video-js id='my-video' class='video-js' controls preload='preload' width='640' height='360' data-setup='{}'>
<source src="master.m3u8" type="application/x-mpegURL" />
</video-js>
var player = videojs('my-video', {
html5: {
hls: {
overrideNative: true
}
}
});
It works for me and it fixed other issue where videos were not playing (or juste a few frames) on Android device. You can replace overrideNative: true by overrideNative: !videojs.browser.IS_SAFARI
Initialize the player like this doesn't work :
player.src({
src: 'master.m3u8',
type: 'application/x-mpegURL',
overrideNative: true
});
I've now had my site in production for about a month, and I've had at least 2 people who are get a similar enough issue that I believe it's related. It only happens on Macs, and definitely doesn't happen on all of them, so I haven't been able to determine any additional information. What they see is that the first 5-6 seconds of the video play, and then it freezes and won't continue. I've implemented a system to save the playback position, so hitting Refresh on the page unlocks it and it continues, but it's not an ideal situation.
For some reason I found that this hack fixes this issue, I don't know why, and I don't know what am I breaking with it, but it works:
player.on('ready', function() { player.vhs = null; });It can be reproduced on https://videojs.github.io/http-streaming/ as well by typing
player.vhs = nullin console AFTER loading a video (but before clicking play).
This solution did not work for me quite well. Seek back did not work at all, but this hack helped me solved it (not that dirty).
this.player.on("play", () => {
if(this.player.currentTime() ===0){
this.player.currentTime(0);
}
});
A zip file of the stutter video just in case stutter-first-6-seconds.zip