|
楼主 |
发表于 2016-4-11 15:23:47
|
显示全部楼层
//录音
$scope.doRecordMedia = function (n) {
var doRecordName;
switch (n) {
case 1: //目的录音
if ($scope.PurposeRecordName === "开始录音") {
//目的时间秒表(数据集)
$scope.PurposeSumTime = {
Second2: 0,
Second1: 0,
Minute2: 0,
Minute1: 0,
Hour2: 0,
Hour1: 0
};
doRecordName = "Purpose_" + RecordName;
//录音
MyMedia.mediaStartRecord(doRecordName, $scope.Details, 'purpose_media');
//计时
PurposeTime = MyDate.goStopwatches($scope, $scope.PurposeSumTime);
$scope.PurposeRecordName = "结束录音";
$scope.RecordStatus = true;
} else if ($scope.PurposeRecordName === "结束录音") {
//暂停秒表
clearInterval(PurposeTime);
$scope.Details.p_media_time = JSON.stringify($scope.PurposeSumTime);
MyMedia.mediaStopRecord();
MyMedia.mediaRelease();
$scope.PurposeRecordName = "开始录音";
$scope.RecordStatus = false;
}
break;
case 2: //结束录音
if ($scope.FruitRecordName === "开始录音") {
//目的时间秒表(数据集)
$scope.FruitSumTime = {
Second2: 0,
Second1: 0,
Minute2: 0,
Minute1: 0,
Hour2: 0,
Hour1: 0
};
doRecordName = "Fruit_" + RecordName;
//录音
MyMedia.mediaStartRecord(doRecordName, $scope.Details, 'fruit_media');
//计时
FruitTime = MyDate.goStopwatches($scope, $scope.FruitSumTime);
$scope.FruitRecordName = "结束录音";
$scope.RecordStatus = true;
} else if ($scope.FruitRecordName === "结束录音") {
//暂停秒表
clearInterval(FruitTime);
$scope.Details.f_media_time = JSON.stringify($scope.FruitSumTime);
MyMedia.mediaStopRecord();
MyMedia.mediaRelease();
$scope.FruitRecordName = "开始录音";
$scope.RecordStatus = false;
}
break;
}
};
//播放
$scope.doPlayMedia = function (n, mediaPath) {
var millisecond;
if (!$scope.PalyStatus) {
$scope.PalyStatus = true;
switch (n) {
case 1: //目的录音
millisecond = $scope.PurposeSumTime.Second2 + ($scope.PurposeSumTime.Second1 * 10) + ($scope.PurposeSumTime.Minute2 * 60) + ($scope.PurposeSumTime.Minute1 * 600);
millisecond += ($scope.PurposeSumTime.Hour2 * 3600) + ($scope.PurposeSumTime.Hour1 * 36000);
millisecond = millisecond * 1000 + 1000;
$scope.PurposeSumTime = {
Second2: 0,
Second1: 0,
Minute2: 0,
Minute1: 0,
Hour2: 0,
Hour1: 0
};
MyMedia.mediaPlay(mediaPath);
//计时
PurposeTime = MyDate.goStopwatches($scope, $scope.PurposeSumTime);
$timeout(function () {
//暂停秒表
clearInterval(PurposeTime);
MyMedia.mediaStop();
MyMedia.mediaRelease();
$scope.PalyStatus = false;
}, millisecond);
break;
case 2: //结束录音
millisecond = $scope.FruitSumTime.Second2 + ($scope.FruitSumTime.Second1 * 10) + ($scope.FruitSumTime.Minute2 * 60) + ($scope.FruitSumTime.Minute1 * 600);
millisecond += ($scope.FruitSumTime.Hour2 * 3600) + ($scope.FruitSumTime.Hour1 * 36000);
millisecond = millisecond * 1000 + 1000;
$scope.FruitSumTime = {
Second2: 0,
Second1: 0,
Minute2: 0,
Minute1: 0,
Hour2: 0,
Hour1: 0
};
MyMedia.mediaPlay(mediaPath);
//计时
FruitTime = MyDate.goStopwatches($scope, $scope.FruitSumTime);
$timeout(function () {
//暂停秒表
clearInterval(FruitTime);
MyMedia.mediaStop();
MyMedia.mediaRelease();
$scope.PalyStatus = false;
}, millisecond);
break;
}
}
}; |
|