BaseModule.java
1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.sw.laryngoscope.camera;
import android.content.ContentValues;
import android.hardware.Camera;
import android.media.CamcorderProfile;
import android.provider.MediaStore.Video;
import com.sw.laryngoscope.activity.fragment.HomeFragment;
import com.sw.laryngoscope.utils.Logger;
import java.io.File;
public class BaseModule {
public HomeFragment fragment;
public VideoUI mUI;
public VideoManager mVideoManager;
public static /*final*/ int FACING_BACK_ID = 0;
public static /*final*/ int FACING_FRONT_ID = 1;
//0 OV6946 //1 typec USBcamera //2 OV9734
public long mRecordingStartTime;
//public static long dateTaken = 0l;
public long stopTime = 0l;
public boolean mMediaRecorderRecording = false;
public int mMaxVideoDurationInMs = 3 * 60 * 1000;//2 * 60 * 1000;
public static final int MSG_UPDATE_RECORD_TIME = 5;
Camera frontCamera;
Camera backCamera;
public boolean isBackError = false;
//public static /*final*/ int TMP_CAM_ID = 0;
public void saveVideoFile(String fileName, ContentValues contentValues) {
try {
String finalName = contentValues.getAsString(Video.Media.DATA);
File finalFile = new File(finalName);
if (new File(fileName).renameTo(finalFile)) {
}
} catch (Exception e) {
}
}
public void deleteVideoFile(String fileName) {
File f = new File(fileName);
if (!f.delete()) {
}
}
public int getVideoQuality(int param) {
Logger.d(" -- param " + param);
int type = 0;
if ( param == 0 ) {
type = CamcorderProfile.QUALITY_HIGH;
} else if ( param == 1 ) {
type = CamcorderProfile.QUALITY_720P;
} else if ( param == 2 ) {
type = CamcorderProfile.QUALITY_480P;
}
return type;
}
public boolean isOpenCameraError() {
return isBackError ;
}
}