|
quPaiModule模块,实现了iOS、 Android 平台集成阿里SDK基础版本模块。可以设置录制时长、视频码率、美颜参数等丰富了app视频录制相关功能;(从3.0.5版本开始必须使用升级环境编译打包)
点击进入模块详情
- <!DOCTYPE html>
- <html>
- <head>
- <title>Module Develop</title>
- <meta charset="utf-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
- <style type="text/css">
- html, body {
- height: 100%
- }
- body {
- background-color: #fff;
- margin: 0;
- }
- #wrap {
- height: 100%;
- position: relative;
- }
- #header {
- padding-top: 20px;
- background-color: #5082c2;
- height: 44px;
- position: relative;
- }
- #header h1 {
- font-size: 20px;
- height: 44px;
- line-height: 44px;
- margin: 0em;
- color: #fff;
- margin-left: 100px;
- margin-right: 100px;
- text-align: center;
- }
- #main {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-box-pack: center;
- }
- a.button {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-box-pack: center;
- -webkit-box-align: center;
- height: 32px;
- margin: 8px;
- background-color: rgba(240,240,240,1.0);
- border-color: rgba(220,220,220,1.0);
- border-width: 2px;
- border-style: solid;
- }
- a.active {
- background-color: rgba(240,240,240,0.7);
- }
- </style>
- </head>
- <body>
- <div id="wrap">
- <div id="main">
- <a class="button" tapmode="active" onclick="permissionCheck()">摄像头权限验证</a>
- <a class="button" tapmode="active" onclick="record()">录制视频</a>
- <a class="button" tapmode="active" onclick="getCacheSize()">获取缓存大小</a>
- <a class="button" tapmode="active" onclick="clearCache()">清空缓存</a>
- <a class="button" tapmode="active" onclick="playQuPai()">播放录制视频测试</a>
- </div>
- </div>
- </body>
- <script type="text/javascript" src="../script/api.js"></script>
- <script>
- var demo;
- function record() {
- demo.record({
- resolutionMode : 2, //设置分辨率基数 1:360P 2:480P 3:540P 4:720P
- ratioMode : 3, //设置分辨率宽高比 1>3:4 2>1:1 3>9:16
- recordMode : 3, //设置录制模式 1>AUTO 2>PRESS 3>TOUCH
- beautyStatus : true,//是否开启美颜
- beautyLevel : 80, //设置美颜级别 0-100
- isCameraBack : false,//是否默认后置摄像头
- isNeedClip : false, //是否多段录制
- minDuration : 2, //最小时长(秒)
- maxDuration : 30, //最大时长(秒)
- videoQuality : 2, //设置输出视频质量 1:标清 2:高清 3:超清 4:超高清
- gop : 5, //关键帧间隔
- frameRate : 25, //帧率
- isImport : false //
- }, function(ret, err) {
- alert("record|" + JSON.stringify(ret) + " " + JSON.stringify(err));
- if (ret.status) {
- $api.setStorage('videoPath', ret.videoPath);
- }
- });
- }
- function getCacheSize() {
- demo.getCacheSize(function(ret, err) {
- alert(JSON.stringify(ret));
- });
- }
- function clearCache() {
- demo.clearCache(function(ret, err) {
- alert(JSON.stringify(ret));
- });
- }
- function permissionCheck() {
- demo.permissionCheck(function(ret, err) {
- alert(JSON.stringify(ret));
- });
- }
- function playQuPai() {
- alert($api.getStorage('videoPath'));
- api.openWin({
- name : 'playQuPai',
- url : "openurl.html",
- pageParam : {
- url : $api.getStorage('videoPath')
- }
- });
- }
- function apiready() {
- demo = api.require('quPaiModule');
- if (!demo) {
- alert("请添加模块后编译");
- return;
- }
- }
- </script>
- </html>
复制代码
|
|