2
votes

I try to use video.js as my video player, but reaches error:

Uncaught (in promise): Error: Cannot find module "safe-json-parse/tuple" Error: Cannot find module "safe-json-parse/tuple"

Steps I did:

  1. npm install -S video.js
  2. import videojs from 'video.js';
  3. write code in palyer.ts => videojs('my-player', { controls: true});
  4. above error appears when player page is hit.

Anybody has any idea? Or what other 3rd party html5 video player can be easily plugged in?

environment details:

ionic info

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1 
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v6.10.3
OS         : Linux 4.10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.10 
2
No errors during npm install -s video.js? - robbannn
no, should there be? Instead of using npm, I added its js and css into index.html and declare var videojs: any in any ts file. this works but not as elegent as loading npm modules. - Xi Xiao
There could have been because the error message said it was unable to find one of video.js dependencies. - robbannn
having the same issue - VirtualProdigy

2 Answers

2
votes

I did the same thing, I had a safe-json-parse module so thought I was fine, but after doing:

npm install -s safe-json-parse

new files were added and the error was gone.

0
votes

I downloaded the videojs js and css files to assets/ folder and references them in index.html.

By this way videojs works, though not as elegant as with npm package