question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HttpXHRPlugin registration changed in 3.0.0

See original GitHub issue

Have you read the FAQ and checked for duplicate open issues? Yes

What version of Shaka Player are you using? 3.0.0

Can you reproduce the issue with our latest release version? 3.0.0 is the latest at the point of opening of the issue so yes.

Can you reproduce the issue with the latest code from master? Not tried yet.

Are you using the demo app or your own custom app? No, but it happens on a minimalist page with some “necessary interactions” to use HttpXHRPlugin instead of the deafult fetch-based one.

If custom app, can you reproduce the issue using our demo app? Can I set the default scheme handler to XHR on the demo app?

What browser and OS are you using? Chrome 83.0.4103.97 on Windows 10

For embedded devices (smart TVs, etc.), what model and firmware version are you using? I am on a PC.

What are the manifest and license server URIs? Happens before playback start so does not matter I think.

What did you do? Add this snippet to a minimalist player page.

// Make the XHR-based HTTP plugin the default (shaka 2.4+)
if (shaka.net.HttpXHRPlugin) {
    shaka.net.NetworkingEngine.registerScheme('http', shaka.net.HttpXHRPlugin,
    shaka.net.NetworkingEngine.PluginPriority.PREFERRED);
    shaka.net.NetworkingEngine.registerScheme('https', shaka.net.HttpXHRPlugin,
    shaka.net.NetworkingEngine.PluginPriority.PREFERRED);
}

What did you expect to happen? Playback should work normally.

What actually happened? Playback failed with:

Error code undefined object TypeError: Cannot read property 'timeMs' of undefined
    at destroyer.js:63
    at Ob (networking_engine.js:188)
    at multi_map.js:39

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
joeyparrishcommented, Jun 10, 2020

No problem! It was a very long list.

Now that we are being more strict with semantic versioning, though, you will not need to check the upgrade guides so carefully in the future. v3.anything should be 100% compatible with v3.0.0.

I’m glad we could help!

1reaction
joeyparrishcommented, Jun 9, 2020

I’m trying to reproduce this on ChromeOS 83. I commented out the registration of the Fetch-based scheme plugin to force the use of XHR, then recompiled the library and demo. I tried running this in uncompiled, debug, and compiled mode. In all three, I can confirm in the debugger that the XHR plugin is being used, but I can’t reproduce the error you mentioned:

Error code undefined object TypeError: Cannot read property ‘timeMs’ of undefined

Finally I realized the root of the issue. The signature of the plugin has changed in v3.0.0. Instead of registering the plugin class’s constructor, you register its static .parse method: shaka.net.HttpXHRPlugin.parse.

This is mentioned in the upgrade guide, under the heading “Built-in network scheme plugin changes”: https://shaka-player-demo.appspot.com/docs/api/tutorial-upgrade-v2-5.html

Built-in network scheme plugin changes

Some of the built-in network scheme plugins have changed their API. Instead of registering the class itself, they now register a static parse() method on the class. Any applications with scheme plugins that delegate to these built-in plugins MUST update to call the new methods.

This affects the following classes:

  • shaka.net.DataUriPlugin
  • shaka.net.HttpFetchPlugin
  • shaka.net.HttpXHRPlugin
// v2.5:
function MySchemePlugin(uri, request, requestType, progressUpdated) {
  return shaka.net.DataUriPlugin(
      uri, request, requestType, progressUpdated);
}
shaka.net.NetworkingEngine.registerScheme('data', MySchemePlugin);

// v3.0:
function MySchemePlugin(uri, request, requestType, progressUpdated) {
  return shaka.net.DataUriPlugin.parse(
      uri, request, requestType, progressUpdated);
}

Does this help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

HttpXHRPlugin registration changed in 3.0.0 #2630 - GitHub
The signature of the plugin has changed in v3.0.0. Instead of registering the plugin class's constructor, you register its static .parse method: ...
Read more >
Class: shaka.net.HttpXHRPlugin - JSDoc
A networking plugin to handle http and https URIs via XHR. Constructor. new HttpXHRPlugin(). A networking plugin to handle http and https URIs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found