Javascript Ionic Cordova无法在社交网站上共享视频
我正在尝试使用cordova社交分享插件在社交网站上分享视频。到目前为止,我所取得的成就是,我已经成功地使用以下代码捕获了视频-Javascript Ionic Cordova无法在社交网站上共享视频,javascript,ionic-framework,cordova-plugins,Javascript,Ionic Framework,Cordova Plugins,我正在尝试使用cordova社交分享插件在社交网站上分享视频。到目前为止,我所取得的成就是,我已经成功地使用以下代码捕获了视频- var options = { limit: 1, duration: 15 }; $cordovaCapture.captureVideo(options).then(function (videoData) { $scope.videoUrl
var options = {
limit: 1,
duration: 15
};
$cordovaCapture.captureVideo(options).then(function (videoData) {
$scope.videoUrl = videoData[0].fullPath;
}, function (err) {
// An error occurred. Show a message to the user
//alert("video error : "+err);
});
我可以成功地找到捕获的视频文件url,但不幸的是,我无法将它们共享到社交媒体网站。我尝试过以下两种方法:
$cordovaSocialSharing
.share(message, subject, file, link)
及
现在我的问题是——
提前感谢。我的问题是传递错误的文件路径,因此我找到了如下解决方案:
import {CaptureError, MediaFile, MediaCapture, CaptureImageOptions, Transfer} from "ionic-native";`
declare let cordova: any;
private static options = {
message: '', // not supported on some apps (Facebook, Instagram)
subject: '', // for email
files: [''], // an array of filenames either locally or remotely
url: ''
};
videoOptions: CaptureImageOptions = {limit: 1};
videoData: any;
captureVideo() {
MediaCapture.captureVideo(this.videoOptions)
.then(
(data: MediaFile[]) => {
this.videoData = data[0];
const fileTransfer = new Transfer();
fileTransfer.download(this.videoData.fullPath, cordova.file.applicationStorageDirectory + 'fileDir/filename.mp4').then((entry) => {
this.options.message = " Your message";
this.options.subject = "Your Subject";
this.options.files = [entry.toURL()];
this.options.url = "https://www.google.com.tr/";
SocialSharing.shareWithOptions(this.options);
}, (error) => {
});
},
(err: CaptureError) => {
}
);
}
正如您在上面看到的,我只是将视频文件复制到应用程序存储目录您找到了解决方案吗?还没有,但我确实找到了有关此主题的更多信息。目前还没有开始工作。但希望我能很快回到这场比赛。也在考虑在这里发布我的发现。谢谢你的提问。关于这个问题你有什么线索吗?谢谢你的回答。我会试试并通知你。:)
import {CaptureError, MediaFile, MediaCapture, CaptureImageOptions, Transfer} from "ionic-native";`
declare let cordova: any;
private static options = {
message: '', // not supported on some apps (Facebook, Instagram)
subject: '', // for email
files: [''], // an array of filenames either locally or remotely
url: ''
};
videoOptions: CaptureImageOptions = {limit: 1};
videoData: any;
captureVideo() {
MediaCapture.captureVideo(this.videoOptions)
.then(
(data: MediaFile[]) => {
this.videoData = data[0];
const fileTransfer = new Transfer();
fileTransfer.download(this.videoData.fullPath, cordova.file.applicationStorageDirectory + 'fileDir/filename.mp4').then((entry) => {
this.options.message = " Your message";
this.options.subject = "Your Subject";
this.options.files = [entry.toURL()];
this.options.url = "https://www.google.com.tr/";
SocialSharing.shareWithOptions(this.options);
}, (error) => {
});
},
(err: CaptureError) => {
}
);
}