我正在尝试使nativescript-videorecorder在我的android设备上工作。我使用了github中的nativescript-videorecorder插件脚本。但是在连接的android设备上对其进行测试时,我无法使其正常工作。
当说“在设备上运行”时,UI会显示在我的设备上,但是当我单击按钮时,什么也没有发生。
以下是app.component.html的代码:
<!-- https://docs.nativescript.org/angular/core-concepts/angular-navigation.html#page-router-outlet -->
<page-router-outlet></page-router-outlet>
<ActionBar title="VideoCamera" class="action-bar">
</ActionBar>
<StackLayout orientation="vertical" row="0" padding="10">
<Label text="Click the button below to record video"></Label>
<Button text="Record Video" (tap)='onCam()'></Button>
</StackLayout>
下面是app.component.ts的代码
import { Component } from "@angular/core";
import { VideoRecorder, Options as VideoRecorderOptions } from "nativescript-videorecorder";
@Component({
selector: "ns-app",
moduleId: module.id,
templateUrl: "./app.component.html",
})
export class AppComponent {
onCam() {
const options: VideoRecorderOptions = {
hd:true,
saveToGallery: true
};
const videorecorder = new VideoRecorder(options);
videorecorder.record().then((data) => {
console.log(data.file)
}).catch((err) => {
console.log(err)
});
}
}