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

ERROR: TypeError: Cannot read property 'duration' of undefined #987

Closed
ProdigyView opened this issue Nov 2, 2020 · 7 comments
Closed

ERROR: TypeError: Cannot read property 'duration' of undefined #987

ProdigyView opened this issue Nov 2, 2020 · 7 comments
Labels

Comments

@ProdigyView
Copy link

Please do not delete the template, by filling out the required information we can investigate your issue more quickly.

Before opening an issue see if your problem can be resolved with the troubleshooting guide.

video.min.js:12 VIDEOJS: ERROR: TypeError: Cannot read property 'duration' of undefined
at G (videojs-http-streaming.min.js:2)
at t.i.getExpiredTime (videojs-http-streaming.min.js:3)
at t.r.stuckAtPlaylistEnd_ (videojs-http-streaming.min.js:7)
at t. (videojs-http-streaming.min.js:7)
at t.o.dispatcher.o.dispatcher (video.min.js:12)
at pe (video.min.js:12)
at t.ye.dispatchEvent.ye.trigger (video.min.js:12)
at t.n.haveMetadata (videojs-http-streaming.min.js:2)
at videojs-http-streaming.min.js:2
at te (videojs-http-streaming.min.js:2)
(anonymous) @ video.min.js:12

Chrome. Might be related to #985

@renepardon
Copy link

This happens to me as well if I watch a live HLS stream, stop the stream and the player tries to connect to the stream again but it fails with this message.

VIDEOJS: ERROR: TypeError: Cannot read property 'duration' of undefined

I'm using Chrome: Version 87.0.4280.88 (Offizieller Build) (x86_64)
And VideoJS installed via Yarn: ^7.10.2

@gkatsev
Copy link
Member

gkatsev commented Jan 21, 2021

@renepardon are you able to reproduce and post how the HLS manifest looks like before and after the stream reconnection? Thanks.

@atyachin
Copy link

@gkatsev here's a sequence of how the manifest file looks like under the scenario of nginx-rtmp restart. The result is the "Cannot read property 'duration' of undefined" after the new manifest is returned:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:46
#EXT-X-TARGETDURATION:2
#EXTINF:2.000,
Z2lkujA-Zvu83N-46.ts
#EXTINF:2.000,
Z2lkujA-Zvu83N-47.ts
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:47
#EXT-X-TARGETDURATION:2
#EXTINF:2.000,
Z2lkujA-Zvu83N-47.ts
#EXTINF:2.000,
Z2lkujA-Zvu83N-48.ts
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.17.9</center>
</body>
</html>
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.17.9</center>
</body>
</html>
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.17.9</center>
</body>
</html>
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.17.9</center>
</body>
</html>
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:4
#EXT-X-DISCONTINUITY
#EXTINF:3.999,
Z2lkujA-Zvu83N-0.ts
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:4
#EXT-X-DISCONTINUITY
#EXTINF:3.999,
Z2lkujA-Zvu83N-0.ts
#EXTINF:2.000,
Z2lkujA-Zvu83N-1.ts
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-TARGETDURATION:2
#EXTINF:2.000,
Z2lkujA-Zvu83N-1.ts
#EXTINF:2.000,
Z2lkujA-Zvu83N-2.ts
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:2
#EXT-X-TARGETDURATION:2
#EXTINF:2.000,
Z2lkujA-Zvu83N-2.ts
#EXTINF:2.000,
Z2lkujA-Zvu83N-3.ts
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:3
#EXT-X-TARGETDURATION:2
#EXTINF:2.000,
Z2lkujA-Zvu83N-3.ts
#EXTINF:2.000,
Z2lkujA-Zvu83N-4.ts
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:4
#EXT-X-TARGETDURATION:2
#EXTINF:2.000,
Z2lkujA-Zvu83N-4.ts
#EXTINF:2.000,
Z2lkujA-Zvu83N-5.ts

@erbesharat
Copy link

No fix found for this issue yet? I'm using m3u8 format and when I stop my stream from OBS and start it again instead of reconnecting I get this error:

VIDEOJS: ERROR: TypeError: Cannot read property 'duration' of undefined
    at sumDurations (video.es.js:28489)
    at SyncController.getExpiredTime (video.es.js:44133)
    at MasterPlaylistController.onSyncInfoUpdate_ (video.es.js:47109)
    at SegmentLoader.<anonymous> (video.es.js:46444)
    at SegmentLoader.data.dispatcher (video.es.js:1901)
    at trigger$1 (video.es.js:2037)
    at SegmentLoader.EventTarget.trigger (video.es.js:2440)
    at SegmentLoader.playlist (video.es.js:40642)
    at MasterPlaylistController.handleUpdatedMediaPlaylist (video.es.js:46307)
    at PlaylistLoader.<anonymous> (video.es.js:46211)
(anonymous) @ video.es.js:100

@renepardon
Copy link

renepardon commented Feb 7, 2021

@renepardon are you able to reproduce and post how the HLS manifest looks like before and after the stream reconnection? Thanks.

Hi,
sorry for late reply. Meanwhile I tried HLS.js directly but figured out that I receive "Buffer Stalled Error"...

Wie video.js on the other hand the m3u8 file which the player can not resume from looks like this:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:3
#EXT-X-MEDIA-SEQUENCE:17
#EXTINF:2.216667,
index17.ts
#EXTINF:1.833333,
index18.ts
#EXTINF:2.966667,
index19.ts
#EXTINF:1.200000,
index20.ts
#EXTINF:1.800000,
index21.ts
#EXTINF:2.033333,
index22.ts
#EXTINF:2.066667,
index23.ts
#EXTINF:1.766667,
index24.ts
#EXTINF:2.333333,
index25.ts
#EXTINF:1.400000,
index26.ts

So I have 10 segments each of 3s. Keyframe interval in OBS is 2s. I changed to 3s now for testing purpose.

The console is spammed full of those errors now: VIDEOJS: ERROR: TypeError: Cannot read property 'duration' of undefined
BUT: if I just wait long enough (for example write this answer) the player starts playing again. ~1 minute or longer

Would be nice if there is a way to detect/catch this duration error and let the player resume at the most recent frame.

@gkatsev
Copy link
Member

gkatsev commented Feb 10, 2021

So, looking at the sample in #987 (comment), that is bad content. The media-sequence being reset to 0 and not having a discontinuity sequence number after the discontinuity tag has been removed from the playlist makes it invalid content. It isn't something we can support fixing.

Have to say I'm surprised it recovers for you @renepardon. Are you able to capture the manifest right before and right after the encoder stops and starts again?

@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants