diff --git a/frameworks/js/camera_napi/src/camera_napi_security_utils.cpp b/frameworks/js/camera_napi/src/camera_napi_security_utils.cpp index 652c457aac4a48325788ebe3a5dd4644568d0907..cf90752add7932c775717aa4ab569e85ec5ccc49 100644 --- a/frameworks/js/camera_napi/src/camera_napi_security_utils.cpp +++ b/frameworks/js/camera_napi/src/camera_napi_security_utils.cpp @@ -23,14 +23,16 @@ namespace OHOS { namespace CameraStandard { namespace CameraNapiSecurity { -bool CheckSystemApp(napi_env env) +bool CheckSystemApp(napi_env env, bool enableThrowError) { uint64_t tokenId = IPCSkeleton::GetSelfTokenID(); int32_t errorCode = CameraErrorCode::NO_SYSTEM_APP_PERMISSION; if (!Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(tokenId)) { - std::string errorMessage = "System api can be invoked only by system applications"; - if (napi_throw_error(env, std::to_string(errorCode).c_str(), errorMessage.c_str()) != napi_ok) { - MEDIA_ERR_LOG("failed to throw err, code=%{public}d, msg=%{public}s.", errorCode, errorMessage.c_str()); + if (enableThrowError) { + std::string errorMessage = "System api can be invoked only by system applications"; + if (napi_throw_error(env, std::to_string(errorCode).c_str(), errorMessage.c_str()) != napi_ok) { + MEDIA_ERR_LOG("failed to throw err, code=%{public}d, msg=%{public}s.", errorCode, errorMessage.c_str()); + } } return false; } diff --git a/frameworks/js/camera_napi/src/input/camera_manager_napi.cpp b/frameworks/js/camera_napi/src/input/camera_manager_napi.cpp index 38471aac8ee8fddfa4a670fc3cf4ea3697fc6974..251e2f80458f16f72ae0cdd5bbaf59385471970c 100644 --- a/frameworks/js/camera_napi/src/input/camera_manager_napi.cpp +++ b/frameworks/js/camera_napi/src/input/camera_manager_napi.cpp @@ -20,12 +20,15 @@ #include "camera_napi_security_utils.h" #include "camera_napi_template_utils.h" #include "camera_napi_utils.h" +#include "camera_napi_security_utils.h" #include "input/camera_napi.h" #include "input/camera_pre_launch_config_napi.h" #include "mode/night_session_napi.h" #include "mode/photo_session_napi.h" +#include "mode/photo_session_for_sys_napi.h" #include "mode/portrait_session_napi.h" #include "mode/video_session_napi.h" +#include "mode/video_session_for_sys_napi.h" namespace OHOS { namespace CameraStandard { using namespace std; @@ -554,10 +557,12 @@ napi_value CameraManagerNapi::CreateSessionInstance(napi_env env, napi_callback_ MEDIA_INFO_LOG("CameraManagerNapi::CreateSessionInstance mode = %{public}d", jsModeName); switch (jsModeName) { case JS_CAPTURE: - result = PhotoSessionNapi::CreateCameraSession(env); + result = CameraNapiSecurity::CheckSystemApp(env, false) ? + PhotoSessionForSysNapi::CreateCameraSession(env) : PhotoSessionNapi::CreateCameraSession(env); break; case JS_VIDEO: - result = VideoSessionNapi::CreateCameraSession(env); + result = CameraNapiSecurity::CheckSystemApp(env, false) ? + VideoSessionForSysNapi::CreateCameraSession(env) : VideoSessionNapi::CreateCameraSession(env); break; case JS_PORTRAIT: result = PortraitSessionNapi::CreateCameraSession(env); diff --git a/frameworks/js/camera_napi/src/mode/photo_session_for_sys_napi.cpp b/frameworks/js/camera_napi/src/mode/photo_session_for_sys_napi.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dbfcbb75c996ba99d3886038a1edad58866565f7 --- /dev/null +++ b/frameworks/js/camera_napi/src/mode/photo_session_for_sys_napi.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mode/photo_session_for_sys_napi.h" + +namespace OHOS { +namespace CameraStandard { +using namespace std; + +thread_local napi_ref PhotoSessionForSysNapi::sConstructor_ = nullptr; + +PhotoSessionForSysNapi::PhotoSessionForSysNapi() : env_(nullptr), wrapper_(nullptr) +{ +} +PhotoSessionForSysNapi::~PhotoSessionForSysNapi() +{ + MEDIA_DEBUG_LOG("~PhotoSessionForSysNapi is called"); + if (wrapper_ != nullptr) { + napi_delete_reference(env_, wrapper_); + } + if (photoSession_) { + photoSession_ = nullptr; + } +} +void PhotoSessionForSysNapi::PhotoSessionForSysNapiDestructor(napi_env env, void* nativeObject, void* finalize_hint) +{ + MEDIA_DEBUG_LOG("PhotoSessionForSysNapiDestructor is called"); + PhotoSessionForSysNapi* cameraObj = reinterpret_cast(nativeObject); + if (cameraObj != nullptr) { + delete cameraObj; + } +} +napi_value PhotoSessionForSysNapi::Init(napi_env env, napi_value exports) +{ + MEDIA_DEBUG_LOG("Init is called"); + napi_status status; + napi_value ctorObj; + std::vector> descriptors = {camera_process_props, + flash_props, auto_exposure_props, focus_props, zoom_props, filter_props, beauty_props, + color_effect_props, macro_props, color_management_props}; + std::vector photo_session_props = CameraNapiUtils::GetPropertyDescriptor(descriptors); + status = napi_define_class(env, PHOTO_SESSION_FOR_SYS_NAPI_CLASS_NAME, NAPI_AUTO_LENGTH, + PhotoSessionForSysNapiConstructor, nullptr, + photo_session_props.size(), + photo_session_props.data(), &ctorObj); + if (status == napi_ok) { + int32_t refCount = 1; + status = napi_create_reference(env, ctorObj, refCount, &sConstructor_); + if (status == napi_ok) { + status = napi_set_named_property(env, exports, PHOTO_SESSION_FOR_SYS_NAPI_CLASS_NAME, ctorObj); + if (status == napi_ok) { + return exports; + } + } + } + MEDIA_ERR_LOG("Init call Failed!"); + return nullptr; +} + +napi_value PhotoSessionForSysNapi::CreateCameraSession(napi_env env) +{ + MEDIA_DEBUG_LOG("CreateCameraSession is called"); + CAMERA_SYNC_TRACE; + napi_status status; + napi_value result = nullptr; + napi_value constructor; + status = napi_get_reference_value(env, sConstructor_, &constructor); + if (status == napi_ok) { + sCameraSession_ = CameraManager::GetInstance()->CreateCaptureSession(SceneMode::CAPTURE); + if (sCameraSession_ == nullptr) { + MEDIA_ERR_LOG("Failed to create Photo session instance"); + napi_get_undefined(env, &result); + return result; + } + status = napi_new_instance(env, constructor, 0, nullptr, &result); + sCameraSession_ = nullptr; + if (status == napi_ok && result != nullptr) { + MEDIA_DEBUG_LOG("success to create Photo session napi instance"); + return result; + } else { + MEDIA_ERR_LOG("Failed to create Photo session napi instance"); + } + } + MEDIA_ERR_LOG("Failed to create Photo session napi instance last"); + napi_get_undefined(env, &result); + return result; +} + +napi_value PhotoSessionForSysNapi::PhotoSessionForSysNapiConstructor(napi_env env, napi_callback_info info) +{ + MEDIA_DEBUG_LOG("PhotoSessionForSysNapiConstructor is called"); + napi_status status; + napi_value result = nullptr; + napi_value thisVar = nullptr; + + napi_get_undefined(env, &result); + CAMERA_NAPI_GET_JS_OBJ_WITH_ZERO_ARGS(env, info, status, thisVar); + + if (status == napi_ok && thisVar != nullptr) { + std::unique_ptr obj = std::make_unique(); + obj->env_ = env; + if (sCameraSession_ == nullptr) { + MEDIA_ERR_LOG("sCameraSession_ is null"); + return result; + } + obj->photoSession_ = static_cast(sCameraSession_.GetRefPtr()); + obj->cameraSession_ = obj->photoSession_; + if (obj->photoSession_ == nullptr) { + MEDIA_ERR_LOG("photoSession_ is null"); + return result; + } + status = napi_wrap(env, thisVar, reinterpret_cast(obj.get()), + PhotoSessionForSysNapi::PhotoSessionForSysNapiDestructor, nullptr, nullptr); + if (status == napi_ok) { + obj.release(); + return thisVar; + } else { + MEDIA_ERR_LOG("PhotoSessionForSysNapi Failure wrapping js to native napi"); + } + } + MEDIA_ERR_LOG("PhotoSessionForSysNapi call Failed!"); + return result; +} +} // namespace CameraStandard +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/js/camera_napi/src/mode/photo_session_napi.cpp b/frameworks/js/camera_napi/src/mode/photo_session_napi.cpp index 9238e47838a9566cd41b563d3269dace92d399bd..efabd8235f8f418f7baa8c4d2c5edf9d2cd3d93e 100644 --- a/frameworks/js/camera_napi/src/mode/photo_session_napi.cpp +++ b/frameworks/js/camera_napi/src/mode/photo_session_napi.cpp @@ -48,8 +48,7 @@ napi_value PhotoSessionNapi::Init(napi_env env, napi_value exports) napi_status status; napi_value ctorObj; std::vector> descriptors = {camera_process_props, - flash_props, auto_exposure_props, focus_props, zoom_props, filter_props, beauty_props, - color_effect_props, macro_props, color_management_props}; + flash_props, auto_exposure_props, focus_props, zoom_props, filter_props}; std::vector photo_session_props = CameraNapiUtils::GetPropertyDescriptor(descriptors); status = napi_define_class(env, PHOTO_SESSION_NAPI_CLASS_NAME, NAPI_AUTO_LENGTH, PhotoSessionNapiConstructor, nullptr, diff --git a/frameworks/js/camera_napi/src/mode/video_session_for_sys_napi.cpp b/frameworks/js/camera_napi/src/mode/video_session_for_sys_napi.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bc854e3f9062b380b620b603b9ead34600dde611 --- /dev/null +++ b/frameworks/js/camera_napi/src/mode/video_session_for_sys_napi.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mode/video_session_for_sys_napi.h" + +namespace OHOS { +namespace CameraStandard { +using namespace std; + +thread_local napi_ref VideoSessionForSysNapi::sConstructor_ = nullptr; + +VideoSessionForSysNapi::VideoSessionForSysNapi() : env_(nullptr), wrapper_(nullptr) +{ +} +VideoSessionForSysNapi::~VideoSessionForSysNapi() +{ + MEDIA_DEBUG_LOG("~VideoSessionForSysNapi is called"); + if (wrapper_ != nullptr) { + napi_delete_reference(env_, wrapper_); + } + if (videoSession_) { + videoSession_ = nullptr; + } +} +void VideoSessionForSysNapi::VideoSessionForSysNapiDestructor(napi_env env, void* nativeObject, void* finalize_hint) +{ + MEDIA_DEBUG_LOG("VideoSessionForSysNapiDestructor is called"); + VideoSessionForSysNapi* cameraObj = reinterpret_cast(nativeObject); + if (cameraObj != nullptr) { + delete cameraObj; + } +} +napi_value VideoSessionForSysNapi::Init(napi_env env, napi_value exports) +{ + MEDIA_DEBUG_LOG("Init is called"); + napi_status status; + napi_value ctorObj; + std::vector> descriptors = {camera_process_props, + flash_props, auto_exposure_props, focus_props, zoom_props, filter_props, beauty_props, + color_effect_props, macro_props, color_management_props, stabilization_props}; + std::vector video_session_props = CameraNapiUtils::GetPropertyDescriptor(descriptors); + status = napi_define_class(env, VIDEO_SESSION_FOR_SYS_NAPI_CLASS_NAME, NAPI_AUTO_LENGTH, + VideoSessionForSysNapiConstructor, nullptr, + video_session_props.size(), + video_session_props.data(), &ctorObj); + if (status == napi_ok) { + int32_t refCount = 1; + status = napi_create_reference(env, ctorObj, refCount, &sConstructor_); + if (status == napi_ok) { + status = napi_set_named_property(env, exports, VIDEO_SESSION_FOR_SYS_NAPI_CLASS_NAME, ctorObj); + if (status == napi_ok) { + return exports; + } + } + } + MEDIA_ERR_LOG("Init call Failed!"); + return nullptr; +} + +napi_value VideoSessionForSysNapi::CreateCameraSession(napi_env env) +{ + MEDIA_DEBUG_LOG("CreateCameraSession is called"); + CAMERA_SYNC_TRACE; + napi_status status; + napi_value result = nullptr; + napi_value constructor; + status = napi_get_reference_value(env, sConstructor_, &constructor); + if (status == napi_ok) { + sCameraSession_ = CameraManager::GetInstance()->CreateCaptureSession(SceneMode::VIDEO); + if (sCameraSession_ == nullptr) { + MEDIA_ERR_LOG("Failed to create Video session instance"); + napi_get_undefined(env, &result); + return result; + } + status = napi_new_instance(env, constructor, 0, nullptr, &result); + sCameraSession_ = nullptr; + if (status == napi_ok && result != nullptr) { + MEDIA_DEBUG_LOG("success to create Video session napi instance"); + return result; + } else { + MEDIA_ERR_LOG("Failed to create Video session napi instance"); + } + } + MEDIA_ERR_LOG("Failed to create Video session napi instance last"); + napi_get_undefined(env, &result); + return result; +} + +napi_value VideoSessionForSysNapi::VideoSessionForSysNapiConstructor(napi_env env, napi_callback_info info) +{ + MEDIA_DEBUG_LOG("VideoSessionForSysNapiConstructor is called"); + napi_status status; + napi_value result = nullptr; + napi_value thisVar = nullptr; + + napi_get_undefined(env, &result); + CAMERA_NAPI_GET_JS_OBJ_WITH_ZERO_ARGS(env, info, status, thisVar); + + if (status == napi_ok && thisVar != nullptr) { + std::unique_ptr obj = std::make_unique(); + obj->env_ = env; + if (sCameraSession_ == nullptr) { + MEDIA_ERR_LOG("sCameraSession_ is null"); + return result; + } + obj->videoSession_ = static_cast(sCameraSession_.GetRefPtr()); + obj->cameraSession_ = obj->videoSession_; + if (obj->videoSession_ == nullptr) { + MEDIA_ERR_LOG("videoSession_ is null"); + return result; + } + status = napi_wrap(env, thisVar, reinterpret_cast(obj.get()), + VideoSessionForSysNapi::VideoSessionForSysNapiDestructor, nullptr, nullptr); + if (status == napi_ok) { + obj.release(); + return thisVar; + } else { + MEDIA_ERR_LOG("VideoSessionForSysNapi Failure wrapping js to native napi"); + } + } + MEDIA_ERR_LOG("VideoSessionForSysNapi call Failed!"); + return result; +} +} // namespace CameraStandard +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/js/camera_napi/src/mode/video_session_napi.cpp b/frameworks/js/camera_napi/src/mode/video_session_napi.cpp index 4f8f65aeb980966cd2ffa3d31b28fa3b10a9f899..46f75590d7aa1e4c4f6c4536decea52ab5e20c6a 100644 --- a/frameworks/js/camera_napi/src/mode/video_session_napi.cpp +++ b/frameworks/js/camera_napi/src/mode/video_session_napi.cpp @@ -48,8 +48,7 @@ napi_value VideoSessionNapi::Init(napi_env env, napi_value exports) napi_status status; napi_value ctorObj; std::vector> descriptors = {camera_process_props, - flash_props, auto_exposure_props, focus_props, zoom_props, filter_props, beauty_props, - color_effect_props, macro_props, color_management_props, stabilization_props}; + flash_props, auto_exposure_props, focus_props, zoom_props, filter_props, stabilization_props}; std::vector video_session_props = CameraNapiUtils::GetPropertyDescriptor(descriptors); status = napi_define_class(env, VIDEO_SESSION_NAPI_CLASS_NAME, NAPI_AUTO_LENGTH, VideoSessionNapiConstructor, nullptr, diff --git a/frameworks/js/camera_napi/src/native_module_ohos_camera.cpp b/frameworks/js/camera_napi/src/native_module_ohos_camera.cpp index 4d91791cbcfc9138473539cabf00302a1141f1c2..d5d47cb90cbfdb490e37a7ca095abd34d2c10233 100644 --- a/frameworks/js/camera_napi/src/native_module_ohos_camera.cpp +++ b/frameworks/js/camera_napi/src/native_module_ohos_camera.cpp @@ -41,7 +41,9 @@ static napi_value Export(napi_env env, napi_value exports) PortraitSessionNapi::Init(env, exports); NightSessionNapi::Init(env, exports); PhotoSessionNapi::Init(env, exports); + PhotoSessionForSysNapi::Init(env, exports); VideoSessionNapi::Init(env, exports); + VideoSessionForSysNapi::Init(env, exports); ModeManagerNapi::Init(env, exports); PhotoNapi::Init(env, exports); DeferredPhotoProxyNapi::Init(env, exports); diff --git a/interfaces/kits/js/camera_napi/BUILD.gn b/interfaces/kits/js/camera_napi/BUILD.gn index fbdffbf5230feb3996a534ce8de0c519e1dfc294..3702bcbc6c775f9742f761fabdde5186a1b06741 100644 --- a/interfaces/kits/js/camera_napi/BUILD.gn +++ b/interfaces/kits/js/camera_napi/BUILD.gn @@ -59,8 +59,10 @@ ohos_shared_library("camera_napi") { "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/listener_base.cpp", "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/mode/mode_manager_napi.cpp", "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/mode/night_session_napi.cpp", + "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/mode/photo_session_for_sys_napi.cpp", "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/mode/photo_session_napi.cpp", "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/mode/portrait_session_napi.cpp", + "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/mode/video_session_for_sys_napi.cpp", "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/mode/video_session_napi.cpp", "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/native_module_ohos_camera.cpp", "${multimedia_camera_framework_path}/frameworks/js/camera_napi/src/output/camera_output_napi.cpp", diff --git a/interfaces/kits/js/camera_napi/include/camera_napi_security_utils.h b/interfaces/kits/js/camera_napi/include/camera_napi_security_utils.h index 9bd9a98e4517d9cbc4c804622dfc831b2f412c74..212e064f0fccb983d621401a3f683ebe126e54b4 100644 --- a/interfaces/kits/js/camera_napi/include/camera_napi_security_utils.h +++ b/interfaces/kits/js/camera_napi/include/camera_napi_security_utils.h @@ -24,7 +24,7 @@ namespace OHOS { namespace CameraStandard { namespace CameraNapiSecurity { -bool CheckSystemApp(napi_env env); +bool CheckSystemApp(napi_env env, bool enableThrowError = true); } } // namespace CameraStandard } // namespace OHOS diff --git a/interfaces/kits/js/camera_napi/include/mode/photo_session_for_sys_napi.h b/interfaces/kits/js/camera_napi/include/mode/photo_session_for_sys_napi.h new file mode 100644 index 0000000000000000000000000000000000000000..bec6d4f4fbabe5529789d70ae01d5383e5b93269 --- /dev/null +++ b/interfaces/kits/js/camera_napi/include/mode/photo_session_for_sys_napi.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PHOTO_SESSION_FOR_SYS_NAPI_H +#define PHOTO_SESSION_FOR_SYS_NAPI_H + +#include "napi/native_api.h" +#include "napi/native_node_api.h" +#include "session/camera_session_napi.h" + +namespace OHOS { +namespace CameraStandard { +static const char PHOTO_SESSION_FOR_SYS_NAPI_CLASS_NAME[] = "PohtoSessionForSys"; +class PhotoSessionForSysNapi : public CameraSessionNapi { +public: + static napi_value Init(napi_env env, napi_value exports); + static napi_value CreateCameraSession(napi_env env); + PhotoSessionForSysNapi(); + ~PhotoSessionForSysNapi(); + + static void PhotoSessionForSysNapiDestructor(napi_env env, void* nativeObject, void* finalize_hint); + static napi_value PhotoSessionForSysNapiConstructor(napi_env env, napi_callback_info info); + + napi_env env_; + napi_ref wrapper_; + sptr photoSession_; + static thread_local napi_ref sConstructor_; +}; +} +} +#endif /* PHOTO_SESSION_FOR_SYS_NAPI_H */ diff --git a/interfaces/kits/js/camera_napi/include/mode/video_session_for_sys_napi.h b/interfaces/kits/js/camera_napi/include/mode/video_session_for_sys_napi.h new file mode 100644 index 0000000000000000000000000000000000000000..ddfe75d9dfd7ca52d4c97724723bc7950e41dde0 --- /dev/null +++ b/interfaces/kits/js/camera_napi/include/mode/video_session_for_sys_napi.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef VIDEO_SESSION_FOR_SYS_NAPI_H +#define VIDEO_SESSION_FOR_SYS_NAPI_H + +#include "napi/native_api.h" +#include "napi/native_node_api.h" +#include "session/camera_session_napi.h" + +namespace OHOS { +namespace CameraStandard { +static const char VIDEO_SESSION_FOR_SYS_NAPI_CLASS_NAME[] = "VideoSessionForSys"; +class VideoSessionForSysNapi : public CameraSessionNapi { +public: + static napi_value Init(napi_env env, napi_value exports); + static napi_value CreateCameraSession(napi_env env); + VideoSessionForSysNapi(); + ~VideoSessionForSysNapi(); + + static void VideoSessionForSysNapiDestructor(napi_env env, void* nativeObject, void* finalize_hint); + static napi_value VideoSessionForSysNapiConstructor(napi_env env, napi_callback_info info); + + napi_env env_; + napi_ref wrapper_; + sptr videoSession_; + static thread_local napi_ref sConstructor_; +}; +} +} +#endif /* VIDEO_SESSION_FOR_SYS_NAPI_H */ diff --git a/interfaces/kits/js/camera_napi/include/native_module_ohos_camera.h b/interfaces/kits/js/camera_napi/include/native_module_ohos_camera.h index 48d2a1907ea824e25f0844b433fed03150bb6a1d..fc9837dc1b218381b17dfe06ea8a9b486bcba381 100644 --- a/interfaces/kits/js/camera_napi/include/native_module_ohos_camera.h +++ b/interfaces/kits/js/camera_napi/include/native_module_ohos_camera.h @@ -26,7 +26,9 @@ #include "mode/night_session_napi.h" #include "mode/portrait_session_napi.h" #include "mode/photo_session_napi.h" +#include "mode/photo_session_for_sys_napi.h" #include "mode/video_session_napi.h" +#include "mode/video_session_for_sys_napi.h" #include "output/metadata_object_napi.h" #include "output/photo_output_napi.h" #include "output/preview_output_napi.h"