Xi Xiao
Xi Xiao

Reputation: 973

ionic use video.js throws error

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 

Upvotes: 2

Views: 949

Answers (2)

nminnoe
nminnoe

Reputation: 21

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.

Upvotes: 2

Xi Xiao
Xi Xiao

Reputation: 973

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

Upvotes: 0

Related Questions