Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Ionic Cordova无法在社交网站上共享视频_Javascript_Ionic Framework_Cordova Plugins - Fatal编程技术网

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

我正在尝试使用cordova社交分享插件在社交网站上分享视频。到目前为止,我所取得的成就是,我已经成功地使用以下代码捕获了视频-

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) => {
            }
          );
      }