moust / cordova-plugin-videoplayer

A Codova plugin to play video with the native MediaPlayer on Android devices.
MIT License
139 stars 102 forks source link

Unhandled Promise Rejection Warning #53

Open ShwetaKhera opened 6 years ago

ShwetaKhera commented 6 years ago

I ran the command " cordova plugin add cordova-plugin-video-player " and gives me the following error:

(node:4008) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec tion id: 1): Error: cmd: Command failed with exit code ENOENT (node:4008) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre cated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

command " ionic info " shows :

cli packages: (C:\Users\shweta\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.0.1
Node              : v9.2.0
npm               : 5.8.0
OS                : Windows 8.1

Environment Variables:

ANDROID_HOME : C:\Users\shweta\AppData\Local\Android\sdk

Misc:

backend : pro

Please help me out.

vancepope commented 6 years ago

Video player returns a promise, so you need to catch it. async playVideo(){ try{ await this.videoPlayer.play(url); console.log("Video is complete"); } catch(e){ console.error(e); } } This gets rid of the Unhandled promise rejections for me, hope this helps if you haven't solved it already.