提交 0a5512fb 编写于 作者: Y yygxr

fix session xts case error on WGR

Signed-off-by: Nyygxr <wuhao30@huawei.com>
上级 786949fd
...@@ -78,8 +78,12 @@ ...@@ -78,8 +78,12 @@
"reason": "use ohos.permission.READ_MEDIA" "reason": "use ohos.permission.READ_MEDIA"
}, },
{ {
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND", "name": "ohos.permission.WRITE_MEDIA",
"reason": "use ohos.permission.START_ABILITIES_FROM_BACKGROUND" "reason": "use ohos.permission.WRITE_MEDIA"
},
{
"name": "ohos.permission.START_ABILIIES_FROM_BACKGROUND",
"reason": "use ohos.permission.START_ABILIIES_FROM_BACKGROUND"
}, },
{ {
"name": "ohos.permission.START_INVISIBLE_ABILITY", "name": "ohos.permission.START_INVISIBLE_ABILITY",
......
...@@ -113,23 +113,35 @@ export default function cameraJSUnitOutput(surfaceId: any) { ...@@ -113,23 +113,35 @@ export default function cameraJSUnitOutput(surfaceId: any) {
} }
} }
async function getvideosurface() { async function getvideosurface() {
await getFd('CameraOutput.mp4'); await getFd('CameraOutput.mp4');
videoConfig.url = fdPath; videoConfig.url = fdPath;
media.createVideoRecorder((err, recorder) => { media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'createVideoRecorder called') if (!err) {
videoRecorder = recorder console.info(TAG + 'createVideoRecorder called')
console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) videoRecorder = recorder
console.info(TAG + 'videoRecorder.prepare called.') console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder))
videoRecorder.prepare(videoConfig, (err) => { console.info(TAG + 'videoRecorder.prepare called.')
console.info(TAG + 'videoRecorder.prepare success.') videoRecorder.prepare(videoConfig, (err) => {
}) if (!err) {
videoRecorder.getInputSurface((err, id) => { console.info(TAG + 'videoRecorder.prepare success.')
console.info(TAG + 'getInputSurface called') videoRecorder.getInputSurface((err, id) => {
videoSurfaceId = id console.info(TAG + 'getInputSurface called')
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoSurfaceId)) if (!err) {
}) videoSurfaceId = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoSurfaceId))
} else {
console.info(TAG + 'getInputSurface FAILED')
}
})
} else {
console.info(TAG + 'prepare FAILED')
}
})
}
else {
console.info(TAG + 'createVideoRecorder FAILED')
}
}) })
} }
...@@ -164,7 +176,7 @@ export default function cameraJSUnitOutput(surfaceId: any) { ...@@ -164,7 +176,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA'; let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA'; let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILITIES_FROM_BACKGROUND'; let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY'; let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'; let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
......
...@@ -82,47 +82,59 @@ export default function cameraManagerTest(surfaceId: any) { ...@@ -82,47 +82,59 @@ export default function cameraManagerTest(surfaceId: any) {
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
selections: fileKeyObj.ID + "=?", selections: fileKeyObj.ID + "=?",
selectionArgs: [args], selectionArgs: [args],
} }
let fetchFileResult = await mediaTest.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
mFileAsset = await fetchFileResult.getAllObject(); mFileAsset = await fetchFileResult.getAllObject();
mFdNumber = await mFileAsset[0].open('Rw'); mFdNumber = await mFileAsset[0].open('Rw');
mFdPath = "fd://" + mFdNumber.toString(); mFdPath = "fd://" + mFdNumber.toString();
} }
} }
async function closeFd() { async function closeFd() {
if (mFileAsset != null) { if (mFileAsset != null) {
await mFileAsset[0].close(mFdNumber).then(() => { await mFileAsset[0].close(mFdNumber).then(() => {
console.info('[mediaLibrary] case close fd success'); console.info('[mediaLibrary] case close fd success');
}).catch((err) => { }).catch((err) => {
console.info('[mediaLibrary] case close fd failed'); console.info('[mediaLibrary] case close fd failed');
}); });
} else { } else {
console.info('[mediaLibrary] case fileAsset is null'); console.info('[mediaLibrary] case fileAsset is null');
} }
} }
async function getVideoReceiveSurface() { async function getVideoReceiveSurface() {
console.log(TAG + 'Entering getVideoReceiveSurface') console.log(TAG + 'Entering getVideoReceiveSurface')
await getFd('CameraManager.mp4'); await getFd('CameraManager.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'Entering create video receiver') if (!err) {
mVideoRecorder = recorder console.info(TAG + 'Entering create video receiver')
console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder)) mVideoRecorder = recorder
console.info(TAG + 'videoRecorder.prepare called.') console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder))
mVideoRecorder.prepare(mVideoConfig, (err) => { console.info(TAG + 'videoRecorder.prepare called.')
console.info(TAG + 'videoRecorder.prepare success.') mVideoRecorder.prepare(mVideoConfig, (err) => {
mVideoRecorder.getInputSurface((err, id) => { if (!err) {
console.info(TAG + 'getInputSurface called') console.info(TAG + 'videoRecorder.prepare success.')
mVideoSurface = id mVideoRecorder.getInputSurface((err, id) => {
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) console.info(TAG + 'getInputSurface called')
if (!err) {
mVideoSurface = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface))
} else {
console.info(TAG + 'getInputSurface FAILED')
}
})
} else {
console.info(TAG + 'prepare FAILED')
}
}) })
}) } else {
console.info(TAG + 'createVideoRecorder FAILED')
}
}) })
console.log(TAG + 'Exit getVideoReceiveSurface') console.log(TAG + 'Exit getVideoReceiveSurface')
} }
...@@ -218,7 +230,7 @@ export default function cameraManagerTest(surfaceId: any) { ...@@ -218,7 +230,7 @@ export default function cameraManagerTest(surfaceId: any) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA'; let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA'; let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILITIES_FROM_BACKGROUND'; let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY'; let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'; let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
......
...@@ -86,7 +86,7 @@ export default function cameraSessionTest(surfaceId: any) { ...@@ -86,7 +86,7 @@ export default function cameraSessionTest(surfaceId: any) {
return false; return false;
} }
async function getFd(pathName){ async function getFd(pathName) {
let displayName = pathName; let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary(); const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
...@@ -94,25 +94,25 @@ export default function cameraSessionTest(surfaceId: any) { ...@@ -94,25 +94,25 @@ export default function cameraSessionTest(surfaceId: any) {
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
selections: fileKeyObj.ID + "=?", selections: fileKeyObj.ID + "=?",
selectionArgs: [args], selectionArgs: [args],
} }
let fetchFileResult = await mediaTest.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
mFileAsset = await fetchFileResult.getAllObject(); mFileAsset = await fetchFileResult.getAllObject();
mFdNumber = await mFileAsset[0].open('Rw'); mFdNumber = await mFileAsset[0].open('Rw');
mFdPath = "fd://" + mFdNumber.toString(); mFdPath = "fd://" + mFdNumber.toString();
} }
} }
async function closeFd() { async function closeFd() {
if (mFileAsset != null) { if (mFileAsset != null) {
await mFileAsset[0].close(mFdNumber).then(() => { await mFileAsset[0].close(mFdNumber).then(() => {
console.info('[mediaLibrary] case close fd success'); console.info('[mediaLibrary] case close fd success');
}).catch((err) => { }).catch((err) => {
console.info('[mediaLibrary] case close fd failed'); console.info('[mediaLibrary] case close fd failed');
}); });
} else { } else {
console.info('[mediaLibrary] case fileAsset is null'); console.info('[mediaLibrary] case fileAsset is null');
} }
...@@ -129,7 +129,7 @@ export default function cameraSessionTest(surfaceId: any) { ...@@ -129,7 +129,7 @@ export default function cameraSessionTest(surfaceId: any) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA'; let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA'; let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILITIES_FROM_BACKGROUND'; let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY'; let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'; let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
...@@ -196,18 +196,30 @@ export default function cameraSessionTest(surfaceId: any) { ...@@ -196,18 +196,30 @@ export default function cameraSessionTest(surfaceId: any) {
await getFd('CameraSessionBase.mp4'); await getFd('CameraSessionBase.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'Entering create video receiver') if (!err) {
mVideoRecorder = recorder console.info(TAG + 'Entering create video receiver')
console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder)) mVideoRecorder = recorder
console.info(TAG + 'videoRecorder.prepare called.') console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder))
mVideoRecorder.prepare(mVideoConfig, (err) => { console.info(TAG + 'videoRecorder.prepare called.')
console.info(TAG + 'videoRecorder.prepare success.') mVideoRecorder.prepare(mVideoConfig, (err) => {
mVideoRecorder.getInputSurface((err, id) => { if (!err) {
console.info(TAG + 'getInputSurface called') console.info(TAG + 'videoRecorder.prepare success.')
mVideoSurface = id mVideoRecorder.getInputSurface((err, id) => {
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) console.info(TAG + 'getInputSurface called')
if (!err) {
mVideoSurface = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface))
} else {
console.info(TAG + 'getInputSurface FAILED')
}
})
} else {
console.info(TAG + 'prepare FAILED')
}
}) })
}) } else {
console.info(TAG + 'createVideoRecorder FAILED')
}
}) })
console.log(TAG + 'Exit getVideoReceiveSurface') console.log(TAG + 'Exit getVideoReceiveSurface')
} }
......
...@@ -141,7 +141,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { ...@@ -141,7 +141,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
return false; return false;
} }
async function getFd(pathName){ async function getFd(pathName) {
let displayName = pathName; let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary(); const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
...@@ -149,27 +149,27 @@ export default function cameraSessionExposureTest(surfaceId: any) { ...@@ -149,27 +149,27 @@ export default function cameraSessionExposureTest(surfaceId: any) {
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
selections: fileKeyObj.ID + "=?", selections: fileKeyObj.ID + "=?",
selectionArgs: [args], selectionArgs: [args],
} }
let fetchFileResult = await mediaTest.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
mFileAsset = await fetchFileResult.getAllObject(); mFileAsset = await fetchFileResult.getAllObject();
mFdNumber = await mFileAsset[0].open('Rw'); mFdNumber = await mFileAsset[0].open('Rw');
mFdPath = "fd://" + mFdNumber.toString(); mFdPath = "fd://" + mFdNumber.toString();
} }
} }
async function closeFd() { async function closeFd() {
if (mFileAsset != null) { if (mFileAsset != null) {
await mFileAsset[0].close(mFdNumber).then(() => { await mFileAsset[0].close(mFdNumber).then(() => {
console.info('[mediaLibrary] case close fd success'); console.info('[mediaLibrary] case close fd success');
}).catch((err) => { }).catch((err) => {
console.info('[mediaLibrary] case close fd failed'); console.info('[mediaLibrary] case close fd failed');
}); });
} else { } else {
console.info('[mediaLibrary] case fileAsset is null'); console.info('[mediaLibrary] case fileAsset is null');
} }
} }
...@@ -184,6 +184,9 @@ export default function cameraSessionExposureTest(surfaceId: any) { ...@@ -184,6 +184,9 @@ export default function cameraSessionExposureTest(surfaceId: any) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA'; let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA'; let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result); console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => { }).catch((err) => {
...@@ -209,6 +212,21 @@ export default function cameraSessionExposureTest(surfaceId: any) { ...@@ -209,6 +212,21 @@ export default function cameraSessionExposureTest(surfaceId: any) {
}).catch((err) => { }).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err); console.info('[permission] case grantUserGrantedPermission failed :' + err);
}); });
await atManager.grantUserGrantedPermission(tokenID, permissionName6, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName7, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName8, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else { } else {
console.info('[permission] case apply permission failed, createAtManager failed'); console.info('[permission] case apply permission failed, createAtManager failed');
} }
...@@ -233,18 +251,30 @@ export default function cameraSessionExposureTest(surfaceId: any) { ...@@ -233,18 +251,30 @@ export default function cameraSessionExposureTest(surfaceId: any) {
await getFd('CameraSessionExposure.mp4'); await getFd('CameraSessionExposure.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'Entering create video receiver') if (!err) {
mVideoRecorder = recorder console.info(TAG + 'Entering create video receiver')
console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder)) mVideoRecorder = recorder
console.info(TAG + 'videoRecorder.prepare called.') console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder))
mVideoRecorder.prepare(mVideoConfig, (err) => { console.info(TAG + 'videoRecorder.prepare called.')
console.info(TAG + 'videoRecorder.prepare success.') mVideoRecorder.prepare(mVideoConfig, (err) => {
mVideoRecorder.getInputSurface((err, id) => { if (!err) {
console.info(TAG + 'getInputSurface called') console.info(TAG + 'videoRecorder.prepare success.')
mVideoSurface = id mVideoRecorder.getInputSurface((err, id) => {
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) console.info(TAG + 'getInputSurface called')
if (!err) {
mVideoSurface = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface))
} else {
console.info(TAG + 'getInputSurface FAILED')
}
})
} else {
console.info(TAG + 'prepare FAILED')
}
}) })
}) } else {
console.info(TAG + 'createVideoRecorder FAILED')
}
}) })
console.log(TAG + 'Exit getVideoReceiveSurface') console.log(TAG + 'Exit getVideoReceiveSurface')
} }
......
...@@ -92,7 +92,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { ...@@ -92,7 +92,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
return false; return false;
} }
async function getFd(pathName){ async function getFd(pathName) {
let displayName = pathName; let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary(); const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
...@@ -100,27 +100,27 @@ export default function cameraSessionFlashTest(surfaceId: any) { ...@@ -100,27 +100,27 @@ export default function cameraSessionFlashTest(surfaceId: any) {
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
selections: fileKeyObj.ID + "=?", selections: fileKeyObj.ID + "=?",
selectionArgs: [args], selectionArgs: [args],
} }
let fetchFileResult = await mediaTest.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
mFileAsset = await fetchFileResult.getAllObject(); mFileAsset = await fetchFileResult.getAllObject();
mFdNumber = await mFileAsset[0].open('Rw'); mFdNumber = await mFileAsset[0].open('Rw');
mFdPath = "fd://" + mFdNumber.toString(); mFdPath = "fd://" + mFdNumber.toString();
} }
} }
async function closeFd() { async function closeFd() {
if (mFileAsset != null) { if (mFileAsset != null) {
await mFileAsset[0].close(mFdNumber).then(() => { await mFileAsset[0].close(mFdNumber).then(() => {
console.info('[mediaLibrary] case close fd success'); console.info('[mediaLibrary] case close fd success');
}).catch((err) => { }).catch((err) => {
console.info('[mediaLibrary] case close fd failed'); console.info('[mediaLibrary] case close fd failed');
}); });
} else { } else {
console.info('[mediaLibrary] case fileAsset is null'); console.info('[mediaLibrary] case fileAsset is null');
} }
} }
...@@ -135,6 +135,9 @@ export default function cameraSessionFlashTest(surfaceId: any) { ...@@ -135,6 +135,9 @@ export default function cameraSessionFlashTest(surfaceId: any) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA'; let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA'; let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result); console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => { }).catch((err) => {
...@@ -160,6 +163,21 @@ export default function cameraSessionFlashTest(surfaceId: any) { ...@@ -160,6 +163,21 @@ export default function cameraSessionFlashTest(surfaceId: any) {
}).catch((err) => { }).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err); console.info('[permission] case grantUserGrantedPermission failed :' + err);
}); });
await atManager.grantUserGrantedPermission(tokenID, permissionName6, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName7, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName8, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else { } else {
console.info('[permission] case apply permission failed, createAtManager failed'); console.info('[permission] case apply permission failed, createAtManager failed');
} }
...@@ -184,18 +202,30 @@ export default function cameraSessionFlashTest(surfaceId: any) { ...@@ -184,18 +202,30 @@ export default function cameraSessionFlashTest(surfaceId: any) {
await getFd('CameraSessionFlush.mp4'); await getFd('CameraSessionFlush.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'Entering create video receiver') if (!err) {
mVideoRecorder = recorder console.info(TAG + 'Entering create video receiver')
console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder)) mVideoRecorder = recorder
console.info(TAG + 'videoRecorder.prepare called.') console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder))
mVideoRecorder.prepare(mVideoConfig, (err) => { console.info(TAG + 'videoRecorder.prepare called.')
console.info(TAG + 'videoRecorder.prepare success.') mVideoRecorder.prepare(mVideoConfig, (err) => {
}) if (!err) {
mVideoRecorder.getInputSurface((err, id) => { console.info(TAG + 'videoRecorder.prepare success.')
console.info(TAG + 'getInputSurface called') mVideoRecorder.getInputSurface((err, id) => {
mVideoSurface = id console.info(TAG + 'getInputSurface called')
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) if (!err) {
}) mVideoSurface = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface))
} else {
console.info(TAG + 'getInputSurface FAILED')
}
})
} else {
console.info(TAG + 'prepare FAILED')
}
})
} else {
console.info(TAG + 'createVideoRecorder FAILED')
}
}) })
console.log(TAG + 'Exit getVideoReceiveSurface') console.log(TAG + 'Exit getVideoReceiveSurface')
} }
......
...@@ -138,7 +138,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { ...@@ -138,7 +138,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
return false; return false;
} }
async function getFd(pathName){ async function getFd(pathName) {
let displayName = pathName; let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary(); const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
...@@ -146,27 +146,27 @@ export default function cameraSessionFocusTest(surfaceId: any) { ...@@ -146,27 +146,27 @@ export default function cameraSessionFocusTest(surfaceId: any) {
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
selections: fileKeyObj.ID + "=?", selections: fileKeyObj.ID + "=?",
selectionArgs: [args], selectionArgs: [args],
} }
let fetchFileResult = await mediaTest.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
mFileAsset = await fetchFileResult.getAllObject(); mFileAsset = await fetchFileResult.getAllObject();
mFdNumber = await mFileAsset[0].open('Rw'); mFdNumber = await mFileAsset[0].open('Rw');
mFdPath = "fd://" + mFdNumber.toString(); mFdPath = "fd://" + mFdNumber.toString();
} }
} }
async function closeFd() { async function closeFd() {
if (mFileAsset != null) { if (mFileAsset != null) {
await mFileAsset[0].close(mFdNumber).then(() => { await mFileAsset[0].close(mFdNumber).then(() => {
console.info('[mediaLibrary] case close fd success'); console.info('[mediaLibrary] case close fd success');
}).catch((err) => { }).catch((err) => {
console.info('[mediaLibrary] case close fd failed'); console.info('[mediaLibrary] case close fd failed');
}); });
} else { } else {
console.info('[mediaLibrary] case fileAsset is null'); console.info('[mediaLibrary] case fileAsset is null');
} }
} }
...@@ -181,6 +181,9 @@ export default function cameraSessionFocusTest(surfaceId: any) { ...@@ -181,6 +181,9 @@ export default function cameraSessionFocusTest(surfaceId: any) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA'; let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA'; let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result); console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => { }).catch((err) => {
...@@ -206,6 +209,21 @@ export default function cameraSessionFocusTest(surfaceId: any) { ...@@ -206,6 +209,21 @@ export default function cameraSessionFocusTest(surfaceId: any) {
}).catch((err) => { }).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err); console.info('[permission] case grantUserGrantedPermission failed :' + err);
}); });
await atManager.grantUserGrantedPermission(tokenID, permissionName6, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName7, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName8, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else { } else {
console.info('[permission] case apply permission failed, createAtManager failed'); console.info('[permission] case apply permission failed, createAtManager failed');
} }
...@@ -230,18 +248,30 @@ export default function cameraSessionFocusTest(surfaceId: any) { ...@@ -230,18 +248,30 @@ export default function cameraSessionFocusTest(surfaceId: any) {
await getFd('CameraSessionFocus.mp4'); await getFd('CameraSessionFocus.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'Entering create video receiver') if (!err) {
mVideoRecorder = recorder console.info(TAG + 'Entering create video receiver')
console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder)) mVideoRecorder = recorder
console.info(TAG + 'videoRecorder.prepare called.') console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder))
mVideoRecorder.prepare(mVideoConfig, (err) => { console.info(TAG + 'videoRecorder.prepare called.')
console.info(TAG + 'videoRecorder.prepare success.') mVideoRecorder.prepare(mVideoConfig, (err) => {
}) if (!err) {
mVideoRecorder.getInputSurface((err, id) => { console.info(TAG + 'videoRecorder.prepare success.')
console.info(TAG + 'getInputSurface called') mVideoRecorder.getInputSurface((err, id) => {
mVideoSurface = id console.info(TAG + 'getInputSurface called')
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) if (!err) {
}) mVideoSurface = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface))
} else {
console.info(TAG + 'getInputSurface FAILED')
}
})
} else {
console.info(TAG + 'prepare FAILED')
}
})
} else {
console.info(TAG + 'createVideoRecorder FAILED')
}
}) })
console.log(TAG + 'Exit getVideoReceiveSurface') console.log(TAG + 'Exit getVideoReceiveSurface')
} }
......
...@@ -91,7 +91,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { ...@@ -91,7 +91,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
return false; return false;
} }
async function getFd(pathName){ async function getFd(pathName) {
let displayName = pathName; let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary(); const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
...@@ -99,27 +99,27 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { ...@@ -99,27 +99,27 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
selections: fileKeyObj.ID + "=?", selections: fileKeyObj.ID + "=?",
selectionArgs: [args], selectionArgs: [args],
} }
let fetchFileResult = await mediaTest.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
mFileAsset = await fetchFileResult.getAllObject(); mFileAsset = await fetchFileResult.getAllObject();
mFdNumber = await mFileAsset[0].open('Rw'); mFdNumber = await mFileAsset[0].open('Rw');
mFdPath = "fd://" + mFdNumber.toString(); mFdPath = "fd://" + mFdNumber.toString();
} }
} }
async function closeFd() { async function closeFd() {
if (mFileAsset != null) { if (mFileAsset != null) {
await mFileAsset[0].close(mFdNumber).then(() => { await mFileAsset[0].close(mFdNumber).then(() => {
console.info('[mediaLibrary] case close fd success'); console.info('[mediaLibrary] case close fd success');
}).catch((err) => { }).catch((err) => {
console.info('[mediaLibrary] case close fd failed'); console.info('[mediaLibrary] case close fd failed');
}); });
} else { } else {
console.info('[mediaLibrary] case fileAsset is null'); console.info('[mediaLibrary] case fileAsset is null');
} }
} }
...@@ -134,6 +134,9 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { ...@@ -134,6 +134,9 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA'; let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA'; let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result); console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => { }).catch((err) => {
...@@ -159,6 +162,21 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { ...@@ -159,6 +162,21 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
}).catch((err) => { }).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err); console.info('[permission] case grantUserGrantedPermission failed :' + err);
}); });
await atManager.grantUserGrantedPermission(tokenID, permissionName6, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName7, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName8, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else { } else {
console.info('[permission] case apply permission failed, createAtManager failed'); console.info('[permission] case apply permission failed, createAtManager failed');
} }
...@@ -183,18 +201,30 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { ...@@ -183,18 +201,30 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
await getFd('CameraSessionVideoStabilization.mp4'); await getFd('CameraSessionVideoStabilization.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'Entering create video receiver') if (!err) {
mVideoRecorder = recorder console.info(TAG + 'Entering create video receiver')
console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder)) mVideoRecorder = recorder
console.info(TAG + 'videoRecorder.prepare called.') console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder))
mVideoRecorder.prepare(mVideoConfig, (err) => { console.info(TAG + 'videoRecorder.prepare called.')
console.info(TAG + 'videoRecorder.prepare success.') mVideoRecorder.prepare(mVideoConfig, (err) => {
}) if (!err) {
mVideoRecorder.getInputSurface((err, id) => { console.info(TAG + 'videoRecorder.prepare success.')
console.info(TAG + 'getInputSurface called') mVideoRecorder.getInputSurface((err, id) => {
mVideoSurface = id console.info(TAG + 'getInputSurface called')
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) if (!err) {
}) mVideoSurface = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface))
} else {
console.info(TAG + 'getInputSurface FAILED')
}
})
} else {
console.info(TAG + 'prepare FAILED')
}
})
} else {
console.info(TAG + 'createVideoRecorder FAILED')
}
}) })
console.log(TAG + 'Exit getVideoReceiveSurface') console.log(TAG + 'Exit getVideoReceiveSurface')
} }
......
...@@ -93,7 +93,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { ...@@ -93,7 +93,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
return false; return false;
} }
async function getFd(pathName){ async function getFd(pathName) {
let displayName = pathName; let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary(); const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
...@@ -101,27 +101,27 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { ...@@ -101,27 +101,27 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
selections: fileKeyObj.ID + "=?", selections: fileKeyObj.ID + "=?",
selectionArgs: [args], selectionArgs: [args],
} }
let fetchFileResult = await mediaTest.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
mFileAsset = await fetchFileResult.getAllObject(); mFileAsset = await fetchFileResult.getAllObject();
mFdNumber = await mFileAsset[0].open('Rw'); mFdNumber = await mFileAsset[0].open('Rw');
mFdPath = "fd://" + mFdNumber.toString(); mFdPath = "fd://" + mFdNumber.toString();
} }
} }
async function closeFd() { async function closeFd() {
if (mFileAsset != null) { if (mFileAsset != null) {
await mFileAsset[0].close(mFdNumber).then(() => { await mFileAsset[0].close(mFdNumber).then(() => {
console.info('[mediaLibrary] case close fd success'); console.info('[mediaLibrary] case close fd success');
}).catch((err) => { }).catch((err) => {
console.info('[mediaLibrary] case close fd failed'); console.info('[mediaLibrary] case close fd failed');
}); });
} else { } else {
console.info('[mediaLibrary] case fileAsset is null'); console.info('[mediaLibrary] case fileAsset is null');
} }
} }
...@@ -136,6 +136,9 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { ...@@ -136,6 +136,9 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA'; let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA'; let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result); console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => { }).catch((err) => {
...@@ -161,6 +164,21 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { ...@@ -161,6 +164,21 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
}).catch((err) => { }).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err); console.info('[permission] case grantUserGrantedPermission failed :' + err);
}); });
await atManager.grantUserGrantedPermission(tokenID, permissionName6, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName7, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName8, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else { } else {
console.info('[permission] case apply permission failed, createAtManager failed'); console.info('[permission] case apply permission failed, createAtManager failed');
} }
...@@ -185,18 +203,30 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { ...@@ -185,18 +203,30 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
await getFd('CameraSessionZoomRatio.mp4'); await getFd('CameraSessionZoomRatio.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'Entering create video receiver') if (!err) {
mVideoRecorder = recorder console.info(TAG + 'Entering create video receiver')
console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder)) mVideoRecorder = recorder
console.info(TAG + 'videoRecorder.prepare called.') console.info(TAG + 'videoRecorder is :' + JSON.stringify(mVideoRecorder))
mVideoRecorder.prepare(mVideoConfig, (err) => { console.info(TAG + 'videoRecorder.prepare called.')
console.info(TAG + 'videoRecorder.prepare success.') mVideoRecorder.prepare(mVideoConfig, (err) => {
}) if (!err) {
mVideoRecorder.getInputSurface((err, id) => { console.info(TAG + 'videoRecorder.prepare success.')
console.info(TAG + 'getInputSurface called') mVideoRecorder.getInputSurface((err, id) => {
mVideoSurface = id console.info(TAG + 'getInputSurface called')
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) if (!err) {
}) mVideoSurface = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface))
} else {
console.info(TAG + 'getInputSurface FAILED')
}
})
} else {
console.info(TAG + 'prepare FAILED')
}
})
} else {
console.info(TAG + 'createVideoRecorder FAILED')
}
}) })
console.log(TAG + 'Exit getVideoReceiveSurface') console.log(TAG + 'Exit getVideoReceiveSurface')
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册