帖子
帖子
用户
博客
课程
显示全部楼层

[BUG] IOS系统下videoRecorder的open方法,第二次调用时无返回值

[复制链接]
发表于 2018-1-10 13:55:16
本帖最后由 诚实可靠小少年 于 2018-1-10 15:35 编辑

IOS系统下的videoRecorder模块的open方法,第二次调用时无返回值,就是停止录像时,没有返回有关录像录像的信息,只返回了一个eventType:fail,android系统没有问题,麻烦大神们帮忙解决一下, 有点急,万分感谢,模块初始化代码如下
var video_recorder;//视频录制对象
var camera ='back';//设置前后摄像头参数,默认后置摄像头
var videoRecorder = {
    //打开录像机
    open : function(callback) {
        video_recorder = api.require('videoRecorder');
        var orientation=""
        if(api.uiMode == 'pad'){
            orientation = 'left';
        }else{
            orientation = 'portrait';
        }
        video_recorder.open({
            rect : {
                x : 0,
                y : 0,
                w : api.frameWidth,
                h : api.frameHeight
            },
            //录像视频质量,high:超清视频,low:普通质量视频,288p:352*288(CIF),480p:640*480,720p:1280*720,1080p:1920* 1080,2160p:3840* 2160,medium:高清视频
            quality : "high",
            //录制的视频的方向,portrait:竖屏    right:右横屏    left:左横屏    upsideDown:反转竖屏
            orientation : orientation,
            //录制的视频是否自动保存到系统相册
            saveToAlbum : true,
            //录制的视频保存配置
            save : {
                path : 'fs://videoRecorder',
                name : 'firstVideo'
            },
            fixedOn : api.frameName,
            fixed : false
        }, function(ret) {
            if (ret) {   
                callback(ret);
            }
        });
    },
    //开始录像
    start : function(record_time) {
        video_recorder.start({
            //数字,视频录制倒计时计时器,单位为秒(s),亦可通过 stop 接口停止录像
            timer: record_time
        });
    },
    //停止录像
    stop : function(record_time) {
        video_recorder.stop();
    },
    //关闭录像
    close : function(record_time) {
        video_recorder.close();
    },
    //设置前置/后置摄像头
    setCamera:function(){
        camera == 'back' ? camera ='front' : camera ='back';
        video_recorder.setCamera({
            camera: camera
        });
    }
};



调用方法如下:
apiready=function(){
      videoRecorder.open(function(video_info) {
                //IOS系统下的此处的viden_info只返回了一个eventType:fail
                var is_finshed = video_info.eventType;
                if (is_finshed == 'finished') {
                    video_path = video_info.filePath;
                    video_album_path = video_info.albumPath;
                    //$api.attr($api.byId('video_album'), 'src', video_album_path);
                    close(video_path);
                }
           });
}

//开始录像
function start(){
            videoRecorder.start(10);
}

//关闭录像
function close(filePath){
            videoRecorder.close();
        }

//结束录像
function stop() {
            videoRecorder.stop();
        }

//静态页面就不上传了,请大神们自己写几个按钮调用一下吧




380
帖子
4
勋章
6
Y币
我们确认一下

好的好的,多谢
380
帖子
4
勋章
6
Y币
我这里没出现这个问题
  1. <!DOCTYPE html>
  2. <html>

  3. <head>
  4.         <meta charset="utf-8">
  5.         <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6.         <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7.         <title>title</title>
  8.         <link rel="stylesheet" type="text/css" href="../css/api.css" />
  9.         <style>
  10.                 body {
  11.                         padding-top: 20px;
  12.                 }

  13.                 button {
  14.                         margin: 15px;
  15.                 }
  16.         </style>
  17. </head>

  18. <body>
  19.         <button type="button" onclick="start()">start</button>
  20.         <button type="button" onclick="videoRecorder_open()" name="button">videoRecorder_open</button>
  21.         <button type="button" onclick="setFocusMode()" name="button">setFocusMode</button>
  22.         <button type="button" onclick="stop()">stop</button>
  23.         <button type="button" onclick="close1()">close1</button>
  24. </body>
  25. <script type="text/javascript" src="../script/api.js"></script>
  26. <script type="text/javascript">
  27.         function videoRecorder_open() {
  28.                 var videoRecorder = api.require('videoRecorder');
  29.                 videoRecorder.open({
  30.                         rect: {
  31.                                 x: 0,
  32.                                 y: 200,
  33.                                 w: 300,
  34.                                 h: 300
  35.                         },
  36.                         quality: "high",
  37.                         saveToAlbum: true,
  38.                         save: {
  39.                                 path: 'fs://videoRecorder',
  40.                                 name: 'firstVideo1',
  41.                                 type: "mp4"
  42.                         },
  43.                         fixedOn: api.frameName,
  44.                         fixed: false
  45.                 }, function(ret) {
  46.                         if (ret) {
  47.                                 console.log(JSON.stringify(ret));

  48.                         }
  49.                 });

  50.         };

  51.         function start() {
  52.                 var videoRecorder = api.require('videoRecorder');
  53.                 videoRecorder.start({
  54.                         timer: 10
  55.                 });
  56.         }

  57.         function stop() {
  58.                 var videoRecorder = api.require('videoRecorder');
  59.                 videoRecorder.stop({
  60.                         //        timer: 10
  61.                 });
  62.         }

  63.         function close1() {
  64.                 var videoRecorder = api.require('videoRecorder');
  65.                 videoRecorder.close();
  66.         }

  67.         function setFocusMode() {
  68.                 var videoRecorder = api.require('videoRecorder');
  69.                 videoRecorder.setFocusMode({
  70.                         focusMode: 'locked'
  71.                 });
  72.         }

  73.   
  74. </script>

  75. </html>
复制代码
本帖最后由 诚实可靠小少年 于 2018-1-11 09:40 编辑

麻烦您试一下ios的平板,抱歉,是我没说明白,下面图片是我平板的信息 img_0149.png
技术支持-F 发表于 2018-1-10 16:33
我这里没出现这个问题

麻烦您试一下ios的平板,抱歉,是我没说明白,下面图片是我平板的信息
https://community.apicloud.com/b ... ko5b5qoo73b6ykk.png
380
帖子
4
勋章
6
Y币
诚实可靠小少年 发表于 2018-1-11 14:43
麻烦您试一下ios的平板,抱歉,是我没说明白,下面图片是我平板的信息
https://community.apicloud.com/ ...

你的问题解决了吧
您需要登录后才可以回帖 登录

本版积分规则