浏览代码

Merge branch 'master' of http://10.1.235.20:3000/ipu/android-share.git

huangbo 8 年之前
父节点
当前提交
ec877f443d

+ 2 - 2
display-client/assets/mobile-action.xml

@ -58,6 +58,7 @@
58 58
	<action name="getPicture" class="com.wade.mobile.func.MobileCamera" method="getPicture"/>
59 59
	<action name="getBase64Picture" class="com.wade.mobile.func.MobileCamera" method="getBase64Picture"/>
60 60
	<action name="getCompressPicture" class="com.wade.mobile.func.MobileCamera" method="getCompressPicture"/>
61
	
61 62
	<!-- MobileInfo -->
62 63
	<action name="getTerminalType" class="com.wade.mobile.func.MobileInfo" method="getTerminalType"/>
63 64
	<action name="getSysInfo" class="com.wade.mobile.func.MobileInfo" method="getSysInfo"/>
@ -169,7 +170,7 @@
169 170
	<action name="poiNearbySearch" class="com.ai.ipu.baidumap.func.MobileBaiduMap" method="poiNearbySearch"></action>
170 171
	<!-- 视频压缩 -->
171 172
	<action name="videoCompressor" class="com.ai.ipu.videocompressor.func.MobileVideoCompress" method="videoCompressor"></action>
172
	
173
	<action name="getVideoPath" class="com.ai.ipu.videocompressor.func.MobileVideoCompress" method="getVideoPath"/>
173 174
	
174 175
	<action name="poiBoundsSearch" class="com.ai.ipu.baidumap.func.MobileBaiduMap" method="poiBoundsSearch"></action>
175 176
	<action name="lbsLocalSearch" class="com.ai.ipu.baidumap.func.MobileBaiduMap" method="lbsLocalSearch"></action>
@ -178,7 +179,6 @@
178 179

179 180

180 181
    <action name="openActivityFromPlugin" class="com.ai.ipu.func.MobileOpenApp" method="openActivityFromPlugin"></action>
181

182 182
    	<!-- PathMenu -->
183 183
	<action name="openPathMenu" class="com.ai.ipu.ipu_pathmenu.func.MobilePathMenu" method="openPathMenu"></action>
184 184
	<action name="closePathMenu" class="com.ai.ipu.ipu_pathmenu.func.MobilePathMenu" method="closePathMenu"></action>

+ 13 - 2
display-server/web/biz/js/plugin/videocompress.js

@ -1,7 +1,18 @@
1 1
require(["domReady!","wadeMobile", "util"], function(doc,WadeMobile) {
2
	var iscroll = new iScroll("content");
2
	var iscroll = new iScroll("content");
3
	
4
	/**
5
	 * 选择视频
6
	 */
7
	$("#getVideoPath").tap(function(){
8
		WadeMobile.getVideoPath(function(videoPath){
9
			$("#videoPath").html(videoPath);
10
		});
11
	});
12
	
3 13
	//视频压缩
4 14
	$("#videoCompressor").tap(function() {
5
		WadeMobile.videoCompressor();
15
		var videoPath = $("#videoPath").html();
16
		WadeMobile.videoCompressor(videoPath);
6 17
	});
7 18
});

+ 7 - 2
display-server/web/res/js/mobile/expand-mobile.js

@ -49,6 +49,9 @@ define(["require"],function(require) {
49 49
				}
50 50
				storageCallback("getPicture",callback);
51 51
				execute("getPicture", [type],err);
52
			},getVideoPath:function(callback){//获取视频
53
				storageCallback("getVideoPath", callback);
54
				execute("getVideoPath",[]);
52 55
			},transImageToBase64:function(callback,path,err){
53 56
				storageCallback("transImageToBase64",callback);
54 57
				execute("transImageToBase64", [path],err);
@ -337,8 +340,8 @@ define(["require"],function(require) {
337 340
			},clickBaiduMap:function(callback,err){
338 341
				storageCallback("clickBaiduMap",callback);
339 342
				execute("clickBaiduMap",[],err);
340
			},videoCompressor:function(){
341
				execute("videoCompressor",[]);
343
			},videoCompressor:function(param){
344
				execute("videoCompressor",[param]);
342 345
			},sweetAlert:function(param){
343 346
				execute("sweetAlert",[param]);
344 347
			},sweetConfirm:function(param){
@ -375,6 +378,8 @@ define(["require"],function(require) {
375 378
                    execute("clearBackStack",[]);
376 379
                }
377 380
            }
381
			
382
			
378 383
		};
379 384
	})();
380 385
	

+ 15 - 0
display-server/web/template/webapp/plugin/VideoCompress.html

@ -39,7 +39,22 @@
39 39
			</li>
40 40
		</ul>
41 41
	</div>
42
	<div class="c_list">
43
			<ul>
44
				<li>
45
					<div class="content">
46
						<div class="main" id="getVideoPath">
47
							<div class="title">选择视频</div>
48
							<div class="info">
49
								视频路径为:<span id="videoPath"></span>
50
							</div>
51
						</div>
52
					</div>
53
				</li>
54
			</ul>
55
		</div>
42 56
</div>
57
43 58
</div>
44 59
45 60
</body>

+ 51 - 6
ipu-VideoCompressor/src/com/ai/ipu/videocompressor/func/MobileVideoCompress.java

@ -2,6 +2,14 @@ package com.ai.ipu.videocompressor.func;
2 2
3 3
4 4
import org.json.JSONArray;
5
import org.json.JSONException;
6
7
import android.app.Activity;
8
import android.content.Context;
9
import android.content.Intent;
10
import android.database.Cursor;
11
import android.net.Uri;
12
import android.util.Log;
5 13
6 14
import com.ai.ipu.videocompressor.Compressor;
7 15
import com.ai.ipu.videocompressor.util.VideoCompressUtil;
@ -12,12 +20,12 @@ public class MobileVideoCompress extends Plugin {
12 20
	// String filePath = AppInfoUtil.getSdcardPath() + "/video.mp4";
13 21
	// String desPath = AppInfoUtil.getSdcardPath() + "/videoto.mp4";
14 22
//	
15
	String filepath = "/sdcard" + "/video.mp4";
16
	
17
	String decpath = "/sdcard" + "/to.mp4";
18
	
23
//	String filepath = "/sdcard" + "/video.mp4";
24
//	
25
//	String decpath = "/sdcard" + "/to.mp4";
19 26
	
20
	String cmd = "-y -i " + filepath + " -strict -2 -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 640x352 -aspect 16:9 " + decpath;
27
	private static final int VIDEO_CAPTURE = 0;
28
//	String cmd = "-y -i " + filepath + " -strict -2 -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 640x352 -aspect 16:9 " + decpath;
21 29
	private Compressor com;
22 30
	private VideoCompressUtil vcUtil;
23 31
@ -27,7 +35,44 @@ public class MobileVideoCompress extends Plugin {
27 35
		com = new Compressor(context);
28 36
	}
29 37
30
	public void videoCompressor(JSONArray params) {
38
	/**
39
	 * 视频压缩
40
	 * @param params
41
	 * @throws Exception 
42
	 */
43
	public void videoCompressor(JSONArray params) throws Exception {
44
		String filepath = params.getString(0);
45
		String decpath = "/sdcard" + "/to.mp4";
46
		String cmd = "-y -i " + filepath + " -strict -2 -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 640x352 -aspect 16:9 " + decpath;
31 47
		vcUtil.videoCompressor(com, cmd);
32 48
	}
49
	/**
50
	 * 选择视频
51
	 */
52
	public void getVideoPath(JSONArray params){
53
		Intent intent = new Intent(Intent.ACTION_PICK);
54
		intent.setType("video/*");
55
		startActivityForResult(intent, VIDEO_CAPTURE);
56
	}
57
	@Override
58
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
59
		super.onActivityResult(requestCode, resultCode, data);
60
		if (resultCode == Activity.RESULT_OK && requestCode == VIDEO_CAPTURE) {
61
			Uri uri = data.getData();
62
			Cursor cursor = context.getContentResolver().query(uri, null, null, null,
63
					null);
64
			cursor.moveToFirst();
65
			// String number= cursor.getString(0); // 视频编号
66
			String path = cursor.getString(1); // 视频文件路径
67
//			tvPath.setText(path);
68
			// String size = cursor.getString(2); // 视频大小
69
			// String name = cursor.getString(3); // 视频文件名
70
			// Log.e("-----","number="+number);
71
			callback(path);
72
			Log.e("-----", "v_path=" + path);
73
			// Log.e("-----","v_size="+size);
74
			// Log.e("-----","v_name="+name);
75
		}
76
	}
77
	
33 78
}