nativescript-videoplayer icon indicating copy to clipboard operation
nativescript-videoplayer copied to clipboard

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

Open JasonCavendish opened this issue 5 years ago • 4 comments

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?

JasonCavendish avatar Nov 19 '20 12:11 JasonCavendish

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

bradmartin avatar Nov 19 '20 14:11 bradmartin

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 avatar Nov 19 '20 14:11 JasonCavendish

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 🙄

JasonCavendish avatar Nov 25 '20 15:11 JasonCavendish

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.

bradmartin avatar Nov 25 '20 15:11 bradmartin