0

我正在尝试在 NativeScript-Vue 中使用Youtubeplayer 插件。该插件有 Typescript 和 Angular 的演示,但没有 Vue,所以它之前可能从未用 Vue 测试过。

在 main.js 中,我有:

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

在 App.vue 中,我有:

<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>

这对于 IOS 可以构建和运行,但对于 Android,它不会构建。相反,我收到错误:

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

在 GitHub 上发布了一个问题,并在 NativeScript #plugins 论坛中提问。开发人员说他没有空闲时间来处理这个插件,我理解,但这留给其他人来解决插件的未解决问题。我想帮助弄清楚如何解决这个问题,但我不知道从哪里开始。

4

0 回答 0