如何在Nativescript-Vue-Typescript项目中使用NativeScript VideoRecorder插件?

时间:2020-06-04 14:37:05

标签: typescript nativescript nativescript-vue video-recording

我仍在从事涉及nativescript-vue和typescript的项目,我想使用NativeScript VideoRecorder插件(github repo)。我已经阅读了文档并尝试了给定的实现并将其适应项目,但似乎无法正确完成...我设法获得了摄像机的显示,但无法使用AdvancedVideoView API的方法...我想将这些方法附加到按钮上以创建自己的界面...

这是相机代码的一部分。

import { AdvancedVideoView } from "nativescript-videorecorder-x/advanced"

Vue.registerElement('AdvancedVideoView', () => require('nativescript-videorecorder-x/advanced').AdvancedVideoView)

export default class Camera extends Vue {

  startCamera() {
      AdvancedVideoView.requestPermissions()
            .then((res) => console.log(res))
            .catch((error) => console.log(`[CAMERA]{ERROR}: ${error}`))
      const record = new AdvancedVideoView()
      record.startRecording() // This line return a error saying record is undefined
  }
}

这是相机的代码。vue

<template>
  <Page>
    <ActionBar>
      <Label text="Camera"></Label>
    </ActionBar>

    <StackLayout>
      <advancedvideoview
          ref="cameraView"
          height="300"
          width="300"
          quality="MAX_1080p"
          cameraPosition="back"
          fill="false"
      ></advancedvideoview>
      <Button text="Start Camera" @tap="startCamera"/>
    </StackLayout>
  </Page>
</template>

预先感谢您的帮助:)

0 个答案:

没有答案
相关问题