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

[2.6.4] Regression: Uncaught TypeError: Failed to set the 'currentTime' property on 'HTMLMediaElement' #2326

Closed
boris-petrov opened this issue Dec 7, 2017 · 19 comments
Milestone

Comments

@boris-petrov
Copy link

Everything was working fine until 2.6.3. With 2.6.4 I'm getting a:

Uncaught TypeError: Failed to set the 'currentTime' property on 'HTMLMediaElement': The provided double value is non-finite.
    at VideoModel.js:92

This "non-finite" value is coming from this line in StreamController. I don't understand the code at all so I'm not sure whether this is a mistake on my side or really a regression.

Thanks for the hard work on dash.js!

@epiclabsDASH
Copy link
Contributor

Hi @boris-petrov. Could you please let me know which steps are you following to reproduce this issue? Logs from the browser will also help.

Thanks!

@boris-petrov
Copy link
Author

@epiclabsDASH - thanks for the answer!

Well, we have an integration test that failed. :D We create a DRM version of a video, produce an MPD file, go to the webpage and expect to be able to play the video (using Clearkey encryption). Here's the logs:

[6] [dash.js 2.6.4] MediaPlayer has been initialized
[9] EME detected on this user agent! (ProtectionModel_21Jan2015)
[20] Playback Initialized
[49] Parsing complete: ( xml2json: 4.97ms, objectiron: 1.06ms, total: 0.00604s)
[60] MediaSource attached to element.  Waiting on open...
[62] Manifest has been refreshed at Thu Dec 07 2017 17:13:24 GMT+0200 (EET)[1512659604.977]
[91] Native video element event: play
[93] MediaSource is open!
[94] Duration successfully set to: 5.015
[95] Added 0 inline events
[97] video codec: video/mp4;codecs="avc1.64001E"
[109] Perform SIDX load: http://127.0.0.1:8081/some-video-content
[111] audio codec: audio/mp4;codecs="mp4a.40.2"
[116] Perform SIDX load: http://127.0.0.1:8081/some-audio-content
[118] No text data.
[119] No fragmentedText data.
[121] No embeddedText data.
[122] No muxed data.
[128] Requesting seek to time: NaN
[131] Start Event Controller
[148] Parsing segments from SIDX.
[156] Parsing segments from SIDX.
[159] Schedule controller starting for video
[160] Schedule controller starting for audio
[167] ScheduleController video- getNextFragment
[168] ScheduleController video- switch track has been asked, get init request for video with representationid = 1
[173] ScheduleController audio- getNextFragment
[178] ScheduleController audio- switch track has been asked, get init request for audio with representationid = 2
[216] Init fragment finished loading saving to audio's init cache
[224] Init fragment finished loading saving to video's init cache
[235] DRM: onNeedKey
[235] DRM: initData:
[239] DRM: KeySystem Access Granted (org.w3.clearkey)!  Selecting key system...
[241] Native video element event: loadedmetadata
[246] Top quality audio index has changed from undefined to 0
[250] AbrController (audio) stay on 0/0 (buffer: 0)
[251] ScheduleController audio- getNextFragment
[252] Getting the request for audio time : 0
[254] SegmentBase: 0 / 5.015
[255] ScheduleController audio- getNextFragment - request is http://127.0.0.1:8081/some-audio-content
[256] Top quality video index has changed from undefined to 0
[257] AbrController (video) stay on 0/0 (buffer: 0)
[258] ScheduleController video- getNextFragment
[258] Getting the request for video time : 0
[259] SegmentBase: 0 / 5.015
[260] ScheduleController video- getNextFragment - request is http://127.0.0.1:8081/some-video-content
[274] Error generating key request -- TypeError
[285] Schedule controller stopping for video
[288] Schedule controller stopping for audio

I can see this Requesting seek to time: NaN but not sure why it gets there... I'm not sure how more I could help, please tell me if I can do anything more.

@epiclabsDASH
Copy link
Contributor

Could you please share your sample stream with me? Seems there is an issue when generating the key request and would like to be able to reproduce the issue here.

@boris-petrov
Copy link
Author

We are generating the video with FFmpeg 3.4 via this command: ffmpeg -y -f lavfi -i testsrc=duration=5:size=640x480:rate=30 -f lavfi -i sine=frequency=1000:duration=5 path > /dev/null 2>&1 Then we're using the following commands to DRM the video (not sure if this even matters but for completeness sake):

MP4Box -crypt drm.key video-stream.mp4 -out encrypted.mp4
MP4Box -dash 10000 -profile onDemand -out video.mpd encrypted.mp4 audio-stream.mp4

@epiclabsDASH
Copy link
Contributor

Great, thanks for the info. Could you also share information about how you are instantiating dashjs to open that resource?

@boris-petrov
Copy link
Author

boris-petrov commented Dec 8, 2017

Of course - we use video.js (6.4.0) with videojs-contrib-dash (2.9.2). We do something like (nothing special I think):

    player = videojs videoTag,
      controls: true

    player.src
      src: someSrc
      type: someMimeType
      keySystemOptions: [
        name: 'org.w3.clearkey'
        options:
          clearkeys: {}
      ]

The options are not exactly like that and the code is a bit more involved but I don't think we do anything funny. Please tell me if you need more information. Thanks!

P.S. OK, I think I can see the problem. We're actually doing a player.offset(NaN, NaN, restart_beginning: true) which I guess is the culprit. Why it didn't blow up before, I have no idea. Let me investigate a bit further and will close the issue if it's our fault. Thanks for the time!

P.S.S. OK, I've removed that code and the issue still remains...

@epiclabsDASH
Copy link
Contributor

@boris-petrov, unfortunately I can't reproduce the issue here. Could you please send me your sample stream (mpd + video/audio segments)?

@boris-petrov
Copy link
Author

@epiclabsDASH - sure, give me a few days (as I can't do it right now) and I'll attach them here.

@boris-petrov
Copy link
Author

boris-petrov commented Dec 20, 2017

@epiclabsDASH - OK, actually I did it now. :)

test.zip

This ZIP file contains 3 files:

  • test-audioStream.mp4 - the audio stream;
  • test-videoStream.mp4 - the video stream;
  • test-dashDrmContent.mpd - the MPD for the DRM content. Only the video stream is encrypted, the audio is not. Here are the options used for encryption:
alg: "A128KW"
k: "002DD941F8B61C981DC02F0DC8AF437E"
kid: "d7dfec6d-ed24-453c-8a7b-8a26cd35df3a"
kty: "oct"

MP4Box 0.6.1 is used for encryption. Please tell me if I can help with more information.

@epiclabsDASH
Copy link
Contributor

@boris-petrov, could you please check if using below version of dash.js fix your issue?

Dash.js: http://sedate-join.surge.sh/dist/dash.all.debug.js

One question. Are you using ClearKey with a license server or are you directly passing the key and its value in config parameters?

@boris-petrov
Copy link
Author

Thanks for the support! On the question - we are directly passing the parameters, not using a license server.

This version got a bit further - there is no "non-finite" stuff but still an error:

[dash.js 2.6.5] MediaPlayer has been initialized
EME detected on this user agent! (ProtectionModel_21Jan2015)
Playback Initialized
Parsing complete: ( xml2json: 5.74ms, objectiron: 0.990ms, total: 0.00673s)
MediaSource attached to element.  Waiting on open...
Manifest has been refreshed at Thu Dec 21 2017 17:05:33 GMT+0200 (EET)[1513868733.429]
Native video element event: play
MediaSource is open!
Duration successfully set to: 5.015
Added 0 inline events
video codec: video/mp4;codecs="avc1.64001e"
Perform SIDX load: http://127.0.0.1:8081/test-videoStream.mp4
audio codec: audio/mp4;codecs="mp4a.40.2"
Perform SIDX load: http://127.0.0.1:8081/test-audioStream.mp4
No text data.
No fragmentedText data.
No embeddedText data.
No muxed data.
No image data.
Start Event Controller
Parsing segments from SIDX.
Parsing segments from SIDX.
Schedule controller starting for video
Schedule controller starting for audio
ScheduleController - video - getNextFragment
ScheduleController - video - switch track has been asked, get init request for video with representationid = 1
ScheduleController - audio - getNextFragment
ScheduleController - audio - switch track has been asked, get init request for audio with representationid = 2
Init fragment finished loading saving to video's init cache
DRM: onNeedKey
DRM: initData:
DRM: KeySystem Access Granted (org.w3.clearkey)!  Selecting key system...
Init fragment finished loading saving to audio's init cache
Top quality video index has changed from undefined to 0
AbrController (video) stay on 0/0 (buffer: 0)
ScheduleController - video - getNextFragment
Getting the request for video time : 0
SegmentBase: 0 / 5.015
ScheduleController - video - getNextFragment - request is http://127.0.0.1:8081/test-videoStream.mp4
Native video element event: loadedmetadata
Error creating key session! Cannot convert undefined or null to object
Schedule controller stopping for video
Schedule controller stopping for audio
Native video element event: pause
The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22

@boris-petrov
Copy link
Author

boris-petrov commented Feb 15, 2018

Just a bit more information with dash.js 2.6.6. Still getting an error. I noticed in the logs from my previous message Error creating key session! Cannot convert undefined or null to object. Now, with 2.6.6, instead of that error, I'm getting a Error generating key request -- TypeError. Putting a breakpoint here and printing error gives a:

{
  message: "Non ASCII: \u0000\u0000\u00004pssh\u0001\u0000\u0000\u0000\u0010w\u00EF\...",
  stack: "TypeError: Non ASCII: \u0000\u0000\u00004pssh\u0001\u0000\u0000\u0000\u0010w\u00EF\..."
}

@epiclabsDASH - maybe that could help you understand what I'm doing wrong and what made it break after 2.6.3?

@epiclabsDASH
Copy link
Contributor

That's weird, we didn't change anything related with DRM in v2.6.6. @boris-petrov, what are the values of dataType and initData before when calling session.generateRequest?

Any possibility you can share an url that we could use for reproducing and debugging this issue?

@boris-petrov
Copy link
Author

boris-petrov commented Feb 16, 2018

@epiclabsDASH - thanks for the answer! dataType has the value keyids and initData is an ArrayBuffer(52). Does that help in any way?

About a URL for debugging - that would be hard I guess. I'll think what I can do but please don't count on it. I'm still using the same files from my previous comments (which are generated with the commands I've given).

P.S. I see that in version 2.6.3 this dataType in the call to session.generateRequest is hardcoded to be cenc. Could that be the issue somehow?

@epiclabsDASH epiclabsDASH added this to the v2.6.7 milestone Feb 21, 2018
@epiclabsDASH
Copy link
Contributor

@boris-petrov, could you please at least share the mpd of the stream with me? I am in Slack if you prefer to share it privately.

@boris-petrov
Copy link
Author

@epiclabsDASH - I'm not sure I understand. I uploaded the MPD and the audio/video streams in a previous comment of mine (the one that starts with @epiclabsDASH - OK, actually I did it now. :)). Did you miss that or am I misunderstanding something?

@epiclabsDASH
Copy link
Contributor

Oh, sorry, my fault

@epiclabsDASH
Copy link
Contributor

@boris-petrov, issue should be fixed in #2436. Could you please confirm?

@boris-petrov
Copy link
Author

@epiclabsDASH - I confirm, this pull-request fixes my issue. Thank you for the support!

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

No branches or pull requests

2 participants