Skip to content

Plugin: Unable to use lamejs plugin with the React Wiki example #271

@johnblakey

Description

@johnblakey

Description

Attempted to modify the React version from the Wiki https://github.com/collab-project/videojs-record/wiki/React into a lamejs audio-only version with the instructions from https://github.com/collab-project/videojs-record/wiki/Plugins#lamejs and https://github.com/collab-project/videojs-record/blob/master/examples/plugins/audio-only-mp3.html .

Steps to reproduce

  • Create the React Wiki example
  • Modify index.js file:
const videoJsOptions = {
  controls: true,
  width: 600,
  height: 300,
  fluid: false,
  plugins: {
    wavesurfer: {
        src: "live",
        waveColor: "#36393b",
        progressColor: "black",
        debug: true,
        cursorWidth: 1,
        msDisplayMax: 20,
        hideScrollbar: true
    },
    record: {
        audio: true,
        video: false,
        maxLength: 20,
        debug: true,
        audioEngine: "lamejs",
        audioWorkerURL: "../../node_modules/lamejs/worker-example/worker-realtime.js",
        audioSampleRate: 44100,
        audioBitRate: 128
    }
  • Modify the App.js file by adding:
import lamejs from 'videojs-record/dist/plugins/videojs.record.lamejs.js';

Note I added an entry into the webpack.config.dev.js file in the new webpack.ProvidePlugin array similar to the WaveSurfer: 'wavesurfer.js', but adding lamejs: 'lamejs' did not impact the errors. I'm unclear how to use https://github.com/collab-project/videojs-record/wiki/Webpack with the lamejs plugin.

  • Install lamejs npm package
  • Start the local server with npm start
  • Click the microphone icon

Results

Expected

To record mp3 files

Actual

Error thrown when clicking the microphone icon

Error output

index.js:2178 TypeError: EngineClass is not a constructor
    at Record.onDeviceReady (videojs.record.js:2214)
    at wavesurfer.min.js:6
    at Array.forEach (<anonymous>)
    at MicrophonePlugin.value [as fireEvent] (wavesurfer.min.js:6)
    at MicrophonePlugin.gotStream (wavesurfer.microphone.js:442)
    at wavesurfer.microphone.js:274
App.js:45 {type: "error", target: div#myVideo.video-js.vjs-paused.myVideo-dimensions.vjs-wavesurfer.vjs-record.vjs-workinghover.vjs-v7…, relatedTarget: undefined, preventDefault: ƒ, defaultPrevented: false, …}
index.js:2178 VIDEOJS: ERROR: Error: Could not load lamejs plugin
    at Record.onDeviceReady (videojs.record.js:2217)
    at wavesurfer.min.js:6
    at Array.forEach (<anonymous>)
    at MicrophonePlugin.value [as fireEvent] (wavesurfer.min.js:6)
    at MicrophonePlugin.gotStream (wavesurfer.microphone.js:442)
    at wavesurfer.microphone.js:274
App.js:50 device error: Error: Could not load lamejs plugin
    at Record.onDeviceReady (videojs.record.js:2217)
    at wavesurfer.min.js:6
    at Array.forEach (<anonymous>)
    at MicrophonePlugin.value [as fireEvent] (wavesurfer.min.js:6)
    at MicrophonePlugin.gotStream (wavesurfer.microphone.js:442)
    at wavesurfer.microphone.js:274

Additional Information

versions

videojs

2.4.1

browsers

Chrome Version 67.0.3396.99

OSes

macOS High Sierra Version 10.13.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions