0

I am trying to use the Youtubeplayer plugin in NativeScript-Vue. The plugin has demos for Typescript and Angular, but not Vue, so it may never have been tested with Vue before.

In main.js, I have:

Vue.registerElement('YoutubePlayer', () => require('nativescript-youtubeplayer').YoutubePlayer);

And in App.vue, I have:

<template>
    <Page>
        <ActionBar title="Welcome to NativeScript-Vue!"/>
        <GridLayout columns="*" rows="*">
            <YoutubePlayer height="50%" width="90%" id="player" options="" apiKey="...my api key..." src="...my video source..." backgroundColor="gray"></YoutubePlayer>
        </GridLayout>
    </Page>
</template>

This builds and runs OK for IOS, but for Android, it doesn't build. Instead, I get errors:

System.err: com.tns.NativeScriptException:
System.err: Calling js method onCreateView failed
System.err:
System.err: TypeError: Cannot read property 'android' of undefined
System.err: File: "file:///data/data/org.nativescript.application/files/app/vendor.js, line: 14495, column: 34
System.err:
System.err: StackTrace:
System.err:     Frame: function:'YoutubePlayer.createNativeView', file:'file:///data/data/org.nativescript.application/f
iles/app/vendor.js', line: 14495, column: 35
System.err:     Frame: function:'ViewBase._setupUI', file:'file:///data/data/org.nativescript.application/files/app/vend
or.js', line: 33350, column: 25

I've posted an issue on GitHub and asked in the NativeScript #plugins forum. The dev says he doesn't have free time to work on this plugin, which I understand, but that leaves it up to others to resolve the plugin's open issues. I'd like to help figure out how to solve this problem, but I don't know where to begin.

ppritcha
  • 113
  • 5

0 Answers0