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.

Plugin "record" does not exist in NextJS

See original GitHub issue

Description

I’m trying to run the react example on NextJS, but it doesn’t work. However, if I use create-react-app it works fine…

If i try to run without plugins key on options, it works fine, i can reproduce a video with no problem

Well, I needed to make some additional things to be able to get this result. NextJS makes a pre-rendering on server and this library doesn’t work on server (I got an error that i solved using Dynamic Import preventing Server Side Rendering) https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr. So that, I geting this error now, but i’m sure about videojs works fine…

Plugin "record" does not exist.

Steps to reproduce

Video Example Component

// Video Example Component
/* eslint-disable */
import React, { Component } from 'react';

import 'video.js/dist/video-js.css';
import videojs from 'video.js';

import 'webrtc-adapter';
import RecordRTC from 'recordrtc';

// register videojs-record plugin with this import
import 'videojs-record/dist/css/videojs.record.css';
import Record from 'videojs-record/dist/videojs.record.js';

class VideoExample extends Component {
  componentDidMount() {
    // instantiate Video.js
    this.player = videojs(this.videoNode, this.props, () => {
      // print version information at startup
      const version_info =
        'Using video.js ' +
        videojs.VERSION +
        ' with videojs-record ' +
        videojs.getPluginVersion('record') +
        ' and recordrtc ' +
        RecordRTC.version;
      videojs.log(version_info);
    });

    // device is ready
    this.player.on('deviceReady', () => {
      console.log('device is ready!');
    });

    // user clicked the record button and started recording
    this.player.on('startRecord', () => {
      console.log('started recording!');
    });

    // user completed recording and stream is available
    this.player.on('finishRecord', () => {
      // recordedData is a blob object containing the recorded data that
      // can be downloaded by the user, stored on server etc.
      console.log('finished recording: ', this.player.recordedData);
    });

    // error handling
    this.player.on('error', (element, error) => {
      console.warn(error);
    });

    this.player.on('deviceError', () => {
      console.error('device error:', this.player.deviceErrorCode);
    });
  }

  // destroy player on unmount
  componentWillUnmount() {
    if (this.player) {
      this.player.dispose();
    }
  }
  render() {
    return (
      <div data-vjs-player>
        <video
          id="myVideo"
          ref={(node) => (this.videoNode = node)}
          className="video-js vjs-default-skin"
          playsInline></video>
      </div>
    );
  }
}

export default VideoExample;

Video Page

import { NextPage } from 'next';
import dynamic from 'next/dynamic';

const DynamicComponentWithNoSSR = dynamic(
  () => import('@Components/Video/VideoExample'),
  { ssr: false },
);

const videoJsOptions = {
  controls: true,
  bigPlayButton: false,
  width: 320,
  height: 240,
  fluid: false,
  plugins: {
    record: {
      audio: true,
      video: true,
      maxLength: 10,
      debug: true,
    },
  },
};

const VideoPage: NextPage<{}> = () => {
  return (
    <div className="flex">
      <h1>Hola</h1>
      <DynamicComponentWithNoSSR {...videoJsOptions} />
    </div>
  );
};

export default VideoPage;

Results

Expected

Video player with record capabilities

Actual

image

Additional Information

Please include any additional information necessary here. Including the following:

versions

videojs-record: 4.5.0

browsers

Brave - Version 1.27.109 Chromium: 92.0.4515.115 (Official Build) (64-bit)

OSes

Edition Windows 10 Home Version 20H2 Installed on ‎4/‎24/‎2021 OS build 19042.1110 Experience Windows Feature Experience Pack 120.2212.3530.0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
thijstriemstracommented, Aug 3, 2021

I would like to send a PR with a NextJS Example

Sounds good.

0reactions
ajparrahcommented, Aug 3, 2021

@thijstriemstra Maybe, let me try it. I will send a PR as soon as i can make the examples

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught Error: plugin "record" does not exist · Issue #398
Description. I'm running into an issue that others have run into: Uncaught Error: plugin "record" does not exist.
Read more >
Angular 6 videojs-record results in runtime error
videojs fails with the following error. ERROR Error: plugin "record" does not exist at Player.<anonymous> (video.
Read more >
Video.js Plugins
List of plugins for Video.js.
Read more >
Serverless Nextjs Plugin
:warning: This README reflects the latest changes on the master branch. It may or may not yet be published to the latest (stable)...
Read more >
Advanced Features: Measuring performance
js Analytics allows you to analyze and measure the performance of pages using different metrics. You can start collecting your Real Experience Score...
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