如何用TypeScript在Ionic 2应用程序中录制视频?
我正在尝试使用TypeScript在Ionic 2应用程序中捕获视频。拍照是直接的,而且似乎很容易如何用TypeScript在Ionic 2应用程序中录制视频?,typescript,ionic-framework,angular,ionic2,Typescript,Ionic Framework,Angular,Ionic2,我正在尝试使用TypeScript在Ionic 2应用程序中捕获视频。拍照是直接的,而且似乎很容易 Camera.getPicture({ destinationType: Camera.DestinationType.DATA_URL, mediaType: Camera.MediaType.PICTURE, targetHeight: 1000, targetWidth: 1000 }).then((imageD
Camera.getPicture({
destinationType: Camera.DestinationType.DATA_URL,
mediaType: Camera.MediaType.PICTURE,
targetHeight: 1000,
targetWidth: 1000
}).then((imageData) => {
this.base64Image = "data:image/jpeg;base64," + imageData;
}, (err) => {
console.log(err);
});
}
为了捕获视频,我需要做哪些更改?我还没有看一下这个应用程序的代码,但是你可以看看那里使用的插件以及它们是如何工作的(在nexus 7 2013上工作) 以下是所需的插件:
cordova-plugin-camera
cordova-plugin-device
cordova-plugin-media-capture
https://github.com/driftyco/ionic-plugin-keyboard.git
cordova-plugin-statusbar
cordova-plugin-spinner-dialog
cordova-plugin-instagram-assets-picker
cordova-plugin-video-editor
您必须安装媒体捕获插件
爱奥尼亚插件添加cordova插件媒体捕获
,然后安装angular typescript包装器npm安装--save@ionic native/Media capture
import { MediaCapture, MediaFile } from '@ionic-native/media-capture'; // import the angular typescript classes from the installed wrapper
@Component(...)
export class Test{
constructor(private mediaCapture: MediaCapture) { } // inject the services in the constructor
this.mediaCapture.captureVideo().then((data: MediaFile[]) =>{
console.log(data) // data is the captured video file object
});
}
检查爱奥尼亚文档中的这个插件我已经看到了另一个问题的答案。我的问题是,在没有ngZone的情况下,如何在typescript应用程序中执行此操作?您是否查看了该链接?你写了一些代码,我们可以看一下吗?我试过使用这些代码。它说属性“device”在类型“Navigator”上不存在。它需要在真实的设备上执行,否则它将无法工作。当然可以。Typescript首先没有被编译