nstudio / nativescript-videoplayer

:clapper: Video Player widget for NativeScript apps
MIT License
133 stars 59 forks source link

Migrated app to v7 and videoplayer 5.0.1, now getting error on compile #179

Open JasonCavendish opened 4 years ago

JasonCavendish commented 4 years ago

I'm new to Nativescript but have used many mobile frameworks, albeit not in JS.

I've inherited an NS6 project which I need to update to NS7.

I've updated the NS files and the videoplayer stopped working so I updated that to 5.0.1 but getting this error on compile.

Module 'nativescript-videoplayer' not found for element 'nativescript-videoplayer:Video'.

Class constructor View cannot be invoked without 'new'

Can anyone shed some light on this?

bradmartin commented 4 years ago

Can you share the project package.json, your code for how you're using the video player as well?

JasonCavendish commented 4 years ago

Package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "scripts": {
    "lint": "eslint \"app/**/*.js\""
  },
  "dependencies": {
    "@nativescript/core": "7.0.0",
    "@nativescript/theme": "2.5.0",
    "@nativescript/webpack": "3.0.0",
    "@progress-nativechat/nativescript-nativechat": "3.0.0",
    "kinvey-nativescript-sdk": "5.0.0",
    "nativescript-accelerometer": "3.0.0",
    "nativescript-background-http": "4.2.1",
    "nativescript-camera": "4.5.0",
    "nativescript-geolocation": "5.1.0",
    "nativescript-image": "2.2.5",
    "nativescript-imagepicker": "7.1.0",
    "nativescript-intl": "3.0.0",
    "nativescript-iqkeyboardmanager": "1.5.1",
    "nativescript-social-share": "1.5.2",
    "nativescript-theme-core": "1.0.6",
    "nativescript-ui-autocomplete": "6.0.0",
    "nativescript-ui-calendar": "6.0.0",
    "nativescript-ui-chart": "7.1.0",
    "nativescript-ui-dataform": "6.0.0",
    "nativescript-ui-gauge": "6.0.0",
    "nativescript-ui-listview": "8.0.1",
    "nativescript-ui-sidedrawer": "8.0.0",
    "nativescript-videoplayer": "^5.0.1"
  },
  "devDependencies": {
    "@nativescript/ios": "7.0.6",
    "@nativescript/types": "7.0.0"
  },
  "author": "",
  "main": "app.js"
}

Usage on Page object: XML:

<Page class="modal-page" xmlns="http://schemas.nativescript.org/tns.xsd" 
    xmlns:VideoPlayer="nativescript-videoplayer" shownModally="onShownModally" unloaded="onNavigatedFrom">

    <DockLayout stretchLastChild="true">

        <AbsoluteLayout class="modal-stack" dock="top">

            <VideoPlayer:Video class="modal-video" id="nativeVideoPlayer" controls="false" autoplay="true" fill="false" top="0" 
left="0" height="100%" width="100%" src="{{ video }}" /> 

JS:

function onNavigatedFrom(args) {
    const video = args.object.getViewById('nativeVideoPlayer') ;
    video.pause();
}

Calling function:

function watchVideo(args) {
    console.log(args.object.bindingContext.video);

    const page = args.object.page;

    page.showModal(
        "./modal/modal",
        { 
          video: args.object.bindingContext.video
        },
        function closeCallback(result) { 
          if (result) {
            console.log("Result was: ", result);
          }
        },
        false // Full screen or not? (on iOS the modal is fullscreen irrespective of this value)
      );
}

Crashes when invoking showModal on the Page object.

JasonCavendish commented 4 years ago

Too many issues to fix after upgrading to V7. I'm going to use Swift to rebuild it from scratch unless there's a fix coming 🙄

bradmartin commented 4 years ago

Not sure what the issue is :) hard to help. V7 was a major version with breaking changes.

If you have any errors or more info on what is broken with your update process I'd be happy to help guide you.

Looks like you might have some plugins/deps that need to be updated but I'm unsure.