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.

VIDEOJS: ERROR: TypeError: Cannot set property 'textContent' of null

See original GitHub issue

Description

This issue didn’t happen when I was using video.js@7.6.6. After I upgraded video.js to version 7.7.5, which is the newest version, the error in the title occurred. It doesn’t affect the main functionality of the recorder component but affects the time display in the control bar.

Error output

VIDEOJS: ERROR: TypeError: Cannot set property 'textContent' of null at Record.setDuration (videojs.record.js:924) at Record.setupUI (videojs.record.js:289) at HTMLDivElement.func (video.es.js:2120) at HTMLDivElement.data.dispatcher (video.es.js:1934) at trigger (video.es.js:2070) at Player.trigger$1 [as trigger] (video.es.js:2955) at Player.eval (video.es.js:3968) at eval (video.es.js:4622)

Steps to reproduce

I’m running Windows 10 and testing with Chrome version 80.0.3987.132 (64-bit). I’m not putting a source tag inside the video tag because it is not needed for recording purpose. Follow the code and versions below to reproduce the error.

Versions

  • react: 16.13.1
  • video.js: 7.7.5
  • videojs-record: 3.11.0
  • webrtc-adapter: 7.5.1

Code

Some of the import and unrelated code is omitted here for conciseness.

import 'videojs-record/dist/css/videojs.record.min.css';

import React, { Component } from 'react';

import videojs from 'video.js';
import 'webrtc-adapter';
import RecordRTC from 'recordrtc';
import Record from 'videojs-record/dist/videojs.record.js';

class Recorder extends Component {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this.player = videojs('recorder', {
            controls: false,
            preload: 'none',
            fill: true,
            aspectRatio: '16:9',
            plugins: {
                record: {
                    audio: true,
                    video: true,
                    maxLength: 1800, // allow maximum of 30-minute recording
                    videoMimeType: 'video/webm;codecs=H264'
                }
            },
            controlBar: {
                deviceButton: false,
                fullscreenToggle: false,
                recordToggle: false
            }
        });
    }

    componentWillUnmount() {
        this.player.record().destroy();
    }

    render() {
        return (
            <div>
                <video id='recorder'
                    className='video-js vjs-theme-fantasy'/>
            </div>
        );
    }

Additional information

The source file I’m using for videojs.record.js is under the dist folder so please refer to that built file by webpack for the line number.

My investigation of the issue is that the setup of the time display UI occurs before the UI is rendered properly. Not sure if it’s directly due to video.js@7.7.5.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
thijstriemstracommented, May 20, 2020

@rexcheng1997 means 4.0.0, 3.12.0 doesn’t exist. And yea stick to videojs 7.7.6 until i get a chance to test 7.8.1. I know the changelog says “videojs 7.7.6 or newer” but it basically means “7.7.6 works for sure, newer versions likely work as well”.

0reactions
abhinavsinghcommented, May 20, 2020

@rexcheng1997 where can I find 3.12.0? Per changelog it jumped from 3.11.0 to 4.0.0. Am I missing something?

Screen Shot 2020-05-21 at 1 27 34 AM
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot set property 'textContent' of null [duplicate]
Currently having issues with this code for a while, and I keep getting errors no matter how much i check it out. The...
Read more >
app.js:6 Uncaught TypeError: Cannot set property 'textContent ...
I cannot find the error in the code that is causing the problem. ... app.js:6 Uncaught TypeError: Cannot set property 'textContent' of null...
Read more >
typeerror: cannot set properties of null (setting 'textcontent') - You ...
The problem is that, you are trying to get an element which has the id program, but there is no element which has...
Read more >
Cannot set properties of null (setting 'textContent') in JS
To solve the "Cannot set property 'textContent' of null" error, make sure that the DOM element you're setting the `textContent` property on exists....
Read more >
LWC Error: Cannot set property 'textContent' of null
Your text variable (the lightning-button ) is null because it's absent from the DOM. It's absent from the DOM because it's inside the ......
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