Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JasonCavendish opened this issue Nov 19, 2020 · 4 comments

Comments

@JasonCavendish
Copy link

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
Copy link
Collaborator

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

@JasonCavendish
Copy link
Author

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
Copy link
Author

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants