cycjimmy/jsmpeg-player

Uncaught TypeError: _this.hooks.load is not a function

finkj opened this issue · 1 comments

finkj commented

Hi,

first of all thanks for that npm-package.
It is working fine. But there is a Error in the Browser Console which could be fixed easy.
I'm using it to stream a video from a raspberry pi to a small web-page.

Describe the bug
Following Error in the Browser Console:

Uncaught TypeError: _this.hooks.load is not a function
    at WSSource.Player.options.hookOnEstablished (jsmpeg.min.js:287)
    at WSSource.onOpen (jsmpeg.min.js:1788)

To Reproduce

Steps to reproduce the behavior:
All i'm doing is:
new JSMpeg.Player(<<url>>, { canvas: canvas })

Expected behavior:
No Error in the Browser Console.

Desktop

  • OS: Linux
  • Browser Chromium
  • Version 70

Additional context
Maybe just add:

  this.options.hookOnEstablished = function () {
    if (_this.hooks.load !== undefined){
        return _this.hooks.load();
    }
  };

😄 Thanks for your issue.

I tested a streaming demo. It looks work fine for jsmpeg-player@2.1.3.

2018-12-06 8 57 54

My test environment:
OS: macOS
Browser: Chrome 70.0.3538.110

❤️ And there's a new version of jsmpeg-player@2.1.4 for updating from jsmpeg.
Try it for your demo first.
If this version can't solve your issue, show me a simple demo went wrong. 🍵