Video.js: Cannot read property 'IS_IOS' of undefined

Created on 31 Jul 2018  路  4Comments  路  Source: videojs/video.js

Description

I'm trying to use videojs 7.2.0 with videojs-youtube 2.5.0 but I'm getting this error: Cannot read property 'IS_IOS' of undefined

It refers to a line of code on videojs-youtube:
var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_NATIVE_ANDROID;

When I do it using cdn it works correctly:
http://jsfiddle.net/victorpfm/yendv5g2/

But when I try to use it inside a vue single file compoonent (SFC) I get that error.

It works when I downgrade to videojs 6.12

When I try to render this component in a test using mount from vue-utils and mocha-webpack the error I get is:
TypeError: Cannot read property 'parentNode' of undefined

Steps to reproduce

Compile this vue SFC:

<template>
    <div>
        <video ref="player" class="video-js vjs-default-skin" controls></video>
    </div>
</template>

<script>
import videojs from 'video.js';
require('videojs-youtube');

export default {
    props: ['src'],

    mounted() {
        let video = videojs(this.$refs.player, {techOrder: ['youtube']});
        video.src({type: 'video/youtube', src: 'https://www.youtube.com/watch?v=q4Gj3zoN3MY'})
    }
}
</script>

Results

Expected

It should render properly since the cdn version works.

Actual

When I compile that component and open it in the browser, I get an error in the console and the video player doesnt get rendered

Error output

Cannot read property 'IS_IOS' of undefined

Additional Information

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

versions

videojs

videojs 7.2.0
videojs-youtube 2.5.0

browsers

just tried with chrome

OSes

just tried on windows 10

plugins

videojs-youtube 2.5.0

Most helpful comment

I can confirm the same with:


Edit: rolling back to [email protected] was the easy fix w/o forking and debugging

All 4 comments

I'm getting the same error message using Yarn as my package manager. Safari and Chrome (MacOS 10.13.6) both throw the same errors.

I can confirm the same with:


Edit: rolling back to [email protected] was the easy fix w/o forking and debugging

Same here.

This is most likely has to do with babel ES6 / ES5 usage and should be fixed via https://github.com/videojs/videojs-youtube/pull/512 in the new videojs-youtube version 2.5.1 which is now out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uikoo9 picture uikoo9  路  4Comments

shivamg705 picture shivamg705  路  4Comments

jeonghwaYoo picture jeonghwaYoo  路  3Comments

dingyaguang117 picture dingyaguang117  路  4Comments

d3x7r0 picture d3x7r0  路  4Comments