• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "frameworks/bridge/declarative_frontend/jsview/js_video.h"
17 
18 #include "base/log/ace_scoring_log.h"
19 #include "bridge/common/utils/engine_helper.h"
20 #include "bridge/declarative_frontend/jsview/js_utils.h"
21 #include "bridge/declarative_frontend/jsview/js_video_controller.h"
22 #include "bridge/declarative_frontend/jsview/models/video_model_impl.h"
23 #include "core/components_ng/base/view_stack_processor.h"
24 #include "core/components_ng/pattern/video/video_model_ng.h"
25 #ifdef SUPPORT_JSSTACK
26 #include "xpower_event_jsvm.h"
27 #endif
28 
29 namespace OHOS::Ace {
GetInstance()30 VideoModel* VideoModel::GetInstance()
31 {
32 #ifdef NG_BUILD
33     static NG::VideoModelNG instance;
34     return &instance;
35 #else
36     if (Container::IsCurrentUseNewPipeline()) {
37         static NG::VideoModelNG instance;
38         return &instance;
39     } else {
40         static Framework::VideoModelImpl instance;
41         return &instance;
42     }
43 #endif
44 }
45 } // namespace OHOS::Ace
46 
47 namespace OHOS::Ace::Framework {
48 
Create(const JSCallbackInfo & info)49 void JSVideo::Create(const JSCallbackInfo& info)
50 {
51     if (!info[0]->IsObject()) {
52         return;
53     }
54     JSRef<JSObject> videoObj = JSRef<JSObject>::Cast(info[0]);
55     JSRef<JSVal> srcValue = videoObj->GetProperty("src");
56     JSRef<JSVal> posterOptionsValue = videoObj->GetProperty("posterOptions");
57     JSRef<JSVal> previewUriValue = videoObj->GetProperty("previewUri");
58     JSRef<JSVal> currentProgressRateValue = videoObj->GetProperty("currentProgressRate");
59 
60     auto controllerObj = videoObj->GetProperty("controller");
61     RefPtr<VideoControllerV2> videoController = nullptr;
62     if (controllerObj->IsObject()) {
63         auto* jsVideoController = JSRef<JSObject>::Cast(controllerObj)->Unwrap<JSVideoController>();
64         if (jsVideoController) {
65             jsVideoController->SetInstanceId(Container::CurrentId());
66             videoController = jsVideoController->GetController();
67         }
68     }
69     VideoModel::GetInstance()->Create(videoController);
70 
71     // Parse the src, if it is invalid, use the empty string.
72     std::string bundleNameSrc;
73     std::string moduleNameSrc;
74     std::string src;
75     int32_t resId = 0;
76     ParseJsMediaWithBundleName(srcValue, src, bundleNameSrc, moduleNameSrc, resId);
77     VideoModel::GetInstance()->SetSrc(src, bundleNameSrc, moduleNameSrc);
78 
79     bool showFirstFrame = false;
80     ParseJsPosterOptions(posterOptionsValue, showFirstFrame);
81     VideoModel::GetInstance()->SetShowFirstFrame(showFirstFrame);
82 
83     // Parse the rate, if it is invalid, set it as 1.0.
84     double currentProgressRate = 1.0;
85     ParseJsDouble(currentProgressRateValue, currentProgressRate);
86     VideoModel::GetInstance()->SetProgressRate(currentProgressRate);
87 
88     auto aiOptions = videoObj->GetProperty("imageAIOptions");
89     if (aiOptions->IsObject()) {
90         ParseImageAIOptions(aiOptions);
91     }
92 
93     std::string previewUri;
94     std::string bundleName;
95     std::string moduleName;
96     GetJsMediaBundleInfo(previewUriValue, bundleName, moduleName);
97     if (previewUriValue->IsUndefined() || previewUriValue->IsNull()) {
98         // When it is undefined, just set the empty image.
99         VideoModel::GetInstance()->SetPosterSourceInfo(previewUri, "", "");
100         return;
101     }
102     auto noPixMap = ParseJsMedia(previewUriValue, previewUri);
103     if (noPixMap) {
104         // Src is a string or resource
105         VideoModel::GetInstance()->SetPosterSourceInfo(previewUri, bundleName, moduleName);
106     } else {
107         // Src is a pixelmap.
108 #if defined(PIXEL_MAP_SUPPORTED)
109         RefPtr<PixelMap> pixMap = CreatePixelMapFromNapiValue(previewUriValue);
110         VideoModel::GetInstance()->SetPosterSourceByPixelMap(pixMap);
111 #endif
112     }
113 }
114 
ParseImageAIOptions(const JSRef<JSVal> & jsValue)115 void JSVideo::ParseImageAIOptions(const JSRef<JSVal>& jsValue)
116 {
117     auto engine = EngineHelper::GetCurrentEngine();
118     CHECK_NULL_VOID(engine);
119     NativeEngine* nativeEngine = engine->GetNativeEngine();
120     CHECK_NULL_VOID(nativeEngine);
121     panda::Local<JsiValue> value = jsValue.Get().GetLocalHandle();
122     JSValueWrapper valueWrapper = value;
123     ScopeRAII scope(reinterpret_cast<napi_env>(nativeEngine));
124     napi_value optionsValue = nativeEngine->ValueToNapiValue(valueWrapper);
125     VideoModel::GetInstance()->SetImageAIOptions(optionsValue);
126 }
127 
ParseJsPosterOptions(const JSRef<JSVal> & jsValue,bool & result)128 bool JSVideo::ParseJsPosterOptions(const JSRef<JSVal>& jsValue, bool& result)
129 {
130     if (!jsValue->IsObject()) {
131         return false;
132     }
133     JSRef<JSObject> jsObj = JSRef<JSObject>::Cast(jsValue);
134     JSRef<JSVal> showFirstFrame = jsObj->GetProperty("showFirstFrame");
135     return ParseJsBool(showFirstFrame, result);
136 }
137 
JsMuted(const JSCallbackInfo & info)138 void JSVideo::JsMuted(const JSCallbackInfo& info)
139 {
140     bool muted = false;
141     if (info[0]->IsBoolean()) {
142         muted = info[0]->ToBoolean();
143 #ifdef SUPPORT_JSSTACK
144         HiviewDFX::ReportXPowerJsStackSysEvent(info.GetVm(), "VOLUME_CHANGE", "SRC=Video");
145 #endif
146     }
147     VideoModel::GetInstance()->SetMuted(muted);
148 }
149 
JsAutoPlay(const JSCallbackInfo & info)150 void JSVideo::JsAutoPlay(const JSCallbackInfo& info)
151 {
152     bool autoPlay = false;
153     if (info[0]->IsBoolean()) {
154         autoPlay = info[0]->ToBoolean();
155 #ifdef SUPPORT_JSSTACK
156         HiviewDFX::ReportXPowerJsStackSysEvent(info.GetVm(), "STREAM_CHANGE", "SRC=Video");
157 #endif
158     }
159     VideoModel::GetInstance()->SetAutoPlay(autoPlay);
160 }
161 
JsControls(const JSCallbackInfo & info)162 void JSVideo::JsControls(const JSCallbackInfo& info)
163 {
164     bool controls = true;
165     if (info[0]->IsBoolean()) {
166         controls = info[0]->ToBoolean();
167     }
168     VideoModel::GetInstance()->SetControls(controls);
169 }
170 
JsLoop(const JSCallbackInfo & info)171 void JSVideo::JsLoop(const JSCallbackInfo& info)
172 {
173     bool loop = false;
174     if (info[0]->IsBoolean()) {
175         loop = info[0]->ToBoolean();
176     }
177     VideoModel::GetInstance()->SetLoop(loop);
178 }
179 
JsObjectFit(const JSCallbackInfo & info)180 void JSVideo::JsObjectFit(const JSCallbackInfo& info)
181 {
182     ImageFit imageFit = ImageFit::COVER;
183     // The default value of Imagefit is FILL, but in the video the default value is COVER.
184     // So the default value need to be converted.
185     if (info[0]->IsUndefined()) {
186         VideoModel::GetInstance()->SetObjectFit(imageFit);
187         return;
188     }
189     if (info[0]->IsNumber()) {
190         imageFit = static_cast<ImageFit>(info[0]->ToNumber<int>());
191     }
192     VideoModel::GetInstance()->SetObjectFit(imageFit);
193 }
194 
JsSurfaceBackgroundColor(const JSCallbackInfo & info)195 void JSVideo::JsSurfaceBackgroundColor(const JSCallbackInfo& info)
196 {
197     Color backgroundColor = Color::BLACK;
198     if (ParseColorMetricsToColor(info[0], backgroundColor) && backgroundColor != Color::TRANSPARENT) {
199         backgroundColor = Color::BLACK;
200     }
201 
202     VideoModel::GetInstance()->SetSurfaceBackgroundColor(backgroundColor);
203 }
204 
JsSetShortcutKeyEnabled(const JSCallbackInfo & info)205 void JSVideo::JsSetShortcutKeyEnabled(const JSCallbackInfo& info)
206 {
207     VideoModel::GetInstance()->SetShortcutKeyEnabled(info[0]->IsBoolean() ? info[0]->ToBoolean() : false);
208 }
209 
JsOnStart(const JSCallbackInfo & info)210 void JSVideo::JsOnStart(const JSCallbackInfo& info)
211 {
212     if (!info[0]->IsFunction()) {
213         return;
214     }
215     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
216     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
217     auto onStart = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
218                        const std::string& param) {
219         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
220         ACE_SCORING_EVENT("Video.onStart");
221         PipelineContext::SetCallBackNode(node);
222         std::vector<std::string> keys = { "start" };
223         func->Execute(keys, param);
224     };
225     VideoModel::GetInstance()->SetOnStart(std::move(onStart));
226 }
227 
JsOnPause(const JSCallbackInfo & info)228 void JSVideo::JsOnPause(const JSCallbackInfo& info)
229 {
230     if (!info[0]->IsFunction()) {
231         return;
232     }
233     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
234     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
235     auto onPause = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
236                        const std::string& param) {
237         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
238         ACE_SCORING_EVENT("Video.onPause");
239         PipelineContext::SetCallBackNode(node);
240         std::vector<std::string> keys = { "pause" };
241         func->Execute(keys, param);
242     };
243     VideoModel::GetInstance()->SetOnPause(std::move(onPause));
244 }
245 
JsOnFinish(const JSCallbackInfo & info)246 void JSVideo::JsOnFinish(const JSCallbackInfo& info)
247 {
248     if (!info[0]->IsFunction()) {
249         return;
250     }
251     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
252     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
253     auto onFinish = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
254                         const std::string& param) {
255         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
256         ACE_SCORING_EVENT("Video.onFinish");
257         PipelineContext::SetCallBackNode(node);
258         std::vector<std::string> keys = { "finish" };
259         func->Execute(keys, param);
260     };
261     VideoModel::GetInstance()->SetOnFinish(std::move(onFinish));
262 }
263 
JsOnStop(const JSCallbackInfo & info)264 void JSVideo::JsOnStop(const JSCallbackInfo& info)
265 {
266     if (!info[0]->IsFunction()) {
267         return;
268     }
269     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
270     auto targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
271     auto onStop = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
272                         const std::string& param) {
273         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
274         ACE_SCORING_EVENT("Video.onStop");
275         PipelineContext::SetCallBackNode(node);
276         std::vector<std::string> keys = { "stop" };
277         func->Execute(keys, param);
278     };
279     VideoModel::GetInstance()->SetOnStop(std::move(onStop));
280 }
281 
JsOnFullscreenChange(const JSCallbackInfo & info)282 void JSVideo::JsOnFullscreenChange(const JSCallbackInfo& info)
283 {
284     if (!info[0]->IsFunction()) {
285         return;
286     }
287     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
288     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
289     auto OnFullScreenChange = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
290                                   const std::string& param) {
291         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
292         ACE_SCORING_EVENT("Video.OnFullScreenChange");
293         PipelineContext::SetCallBackNode(node);
294         std::vector<std::string> keys = { "fullscreen" };
295         func->Execute(keys, param);
296     };
297     VideoModel::GetInstance()->SetOnFullScreenChange(std::move(OnFullScreenChange));
298 }
299 
JsOnPrepared(const JSCallbackInfo & info)300 void JSVideo::JsOnPrepared(const JSCallbackInfo& info)
301 {
302     if (!info[0]->IsFunction()) {
303         return;
304     }
305     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
306     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
307     auto onPrepared = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
308                           const std::string& param) {
309         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
310         ACE_SCORING_EVENT("Video.onPrepared");
311         PipelineContext::SetCallBackNode(node);
312         std::vector<std::string> keys = { "duration" };
313         func->Execute(keys, param);
314     };
315     VideoModel::GetInstance()->SetOnPrepared(std::move(onPrepared));
316 }
317 
JsOnSeeking(const JSCallbackInfo & info)318 void JSVideo::JsOnSeeking(const JSCallbackInfo& info)
319 {
320     if (!info[0]->IsFunction()) {
321         return;
322     }
323     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
324     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
325     auto onSeeking = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
326                          const std::string& param) {
327         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
328         ACE_SCORING_EVENT("Video.onSeeking");
329         PipelineContext::SetCallBackNode(node);
330         std::vector<std::string> keys = { "time" };
331         func->Execute(keys, param);
332     };
333     VideoModel::GetInstance()->SetOnSeeking(std::move(onSeeking));
334 }
335 
JsOnSeeked(const JSCallbackInfo & info)336 void JSVideo::JsOnSeeked(const JSCallbackInfo& info)
337 {
338     if (!info[0]->IsFunction()) {
339         return;
340     }
341     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
342     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
343     auto onSeeked = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
344                         const std::string& param) {
345         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
346         ACE_SCORING_EVENT("Video.onSeeked");
347         PipelineContext::SetCallBackNode(node);
348         std::vector<std::string> keys = { "time" };
349         func->Execute(keys, param);
350     };
351     VideoModel::GetInstance()->SetOnSeeked(std::move(onSeeked));
352 }
353 
JsOnUpdate(const JSCallbackInfo & info)354 void JSVideo::JsOnUpdate(const JSCallbackInfo& info)
355 {
356     if (!info[0]->IsFunction()) {
357         return;
358     }
359     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
360     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
361     auto onUpdate = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
362                         const std::string& param) {
363         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
364         ACE_SCORING_EVENT("Video.onUpdate");
365         PipelineContext::SetCallBackNode(node);
366         std::vector<std::string> keys = { "time" };
367         func->Execute(keys, param);
368     };
369     VideoModel::GetInstance()->SetOnUpdate(std::move(onUpdate));
370 }
371 
JsOnError(const JSCallbackInfo & info)372 void JSVideo::JsOnError(const JSCallbackInfo& info)
373 {
374     if (!info[0]->IsFunction()) {
375         return;
376     }
377     auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
378     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
379     auto onError = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
380                        const std::string& param) {
381         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
382         ACE_SCORING_EVENT("Video.onError");
383         PipelineContext::SetCallBackNode(node);
384         std::vector<std::string> keys = { "code", "name", "message" };
385         func->Execute(keys, param);
386     };
387     VideoModel::GetInstance()->SetOnError(std::move(onError));
388 }
389 
GetEventMarker(const JSCallbackInfo & info,const std::vector<std::string> & keys)390 EventMarker JSVideo::GetEventMarker(const JSCallbackInfo& info, const std::vector<std::string>& keys)
391 {
392     if (!info[0]->IsFunction()) {
393         return EventMarker();
394     }
395 
396     RefPtr<JsFunction> jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(info[0]));
397     WeakPtr<NG::FrameNode> targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode());
398     auto eventMarker = EventMarker([execCtx = info.GetExecutionContext(), func = std::move(jsFunc), keys,
399                                        node = targetNode](const std::string& param) {
400         JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
401         PipelineContext::SetCallBackNode(node);
402         func->Execute(keys, param);
403     });
404     return eventMarker;
405 }
406 
EnableAnalyzer(bool enable)407 void JSVideo::EnableAnalyzer(bool enable)
408 {
409     VideoModel::GetInstance()->EnableAnalyzer(enable);
410 }
411 
AnalyzerConfig(const JSCallbackInfo & info)412 void JSVideo::AnalyzerConfig(const JSCallbackInfo& info)
413 {
414     auto configParams = info[0];
415     if (configParams->IsNull() || !configParams->IsObject()) {
416         return;
417     }
418     auto engine = EngineHelper::GetCurrentEngine();
419     CHECK_NULL_VOID(engine);
420     NativeEngine* nativeEngine = engine->GetNativeEngine();
421     panda::Local<JsiValue> value = configParams.Get().GetLocalHandle();
422     JSValueWrapper valueWrapper = value;
423     ScopeRAII scope(reinterpret_cast<napi_env>(nativeEngine));
424     napi_value nativeValue = nativeEngine->ValueToNapiValue(valueWrapper);
425     VideoModel::GetInstance()->SetImageAnalyzerConfig(nativeValue);
426 }
427 
JSBind(BindingTarget globalObj)428 void JSVideo::JSBind(BindingTarget globalObj)
429 {
430     JSClass<JSVideo>::Declare("Video");
431     MethodOptions opt = MethodOptions::NONE;
432     JSClass<JSVideo>::StaticMethod("create", &JSVideo::Create, opt);
433     JSClass<JSVideo>::StaticMethod("muted", &JSVideo::JsMuted, opt);
434     JSClass<JSVideo>::StaticMethod("autoPlay", &JSVideo::JsAutoPlay, opt);
435     JSClass<JSVideo>::StaticMethod("controls", &JSVideo::JsControls, opt);
436     JSClass<JSVideo>::StaticMethod("loop", &JSVideo::JsLoop, opt);
437     JSClass<JSVideo>::StaticMethod("objectFit", &JSVideo::JsObjectFit, opt);
438     JSClass<JSVideo>::StaticMethod("surfaceBackgroundColor", &JSVideo::JsSurfaceBackgroundColor, opt);
439     JSClass<JSVideo>::StaticMethod("enableShortcutKey", &JSVideo::JsSetShortcutKeyEnabled, opt);
440 
441     JSClass<JSVideo>::StaticMethod("onStart", &JSVideo::JsOnStart);
442     JSClass<JSVideo>::StaticMethod("onPause", &JSVideo::JsOnPause);
443     JSClass<JSVideo>::StaticMethod("onFinish", &JSVideo::JsOnFinish);
444     JSClass<JSVideo>::StaticMethod("onFullscreenChange", &JSVideo::JsOnFullscreenChange);
445     JSClass<JSVideo>::StaticMethod("onPrepared", &JSVideo::JsOnPrepared);
446     JSClass<JSVideo>::StaticMethod("onSeeking", &JSVideo::JsOnSeeking);
447     JSClass<JSVideo>::StaticMethod("onSeeked", &JSVideo::JsOnSeeked);
448     JSClass<JSVideo>::StaticMethod("onUpdate", &JSVideo::JsOnUpdate);
449     JSClass<JSVideo>::StaticMethod("onError", &JSVideo::JsOnError);
450     JSClass<JSVideo>::StaticMethod("onStop", &JSVideo::JsOnStop);
451     JSClass<JSVideo>::StaticMethod("enableAnalyzer", &JSVideo::EnableAnalyzer);
452     JSClass<JSVideo>::StaticMethod("analyzerConfig", &JSVideo::AnalyzerConfig);
453 
454     JSClass<JSVideo>::StaticMethod("onTouch", &JSInteractableView::JsOnTouch);
455     JSClass<JSVideo>::StaticMethod("onHover", &JSInteractableView::JsOnHover);
456     JSClass<JSVideo>::StaticMethod("onKeyEvent", &JSInteractableView::JsOnKey);
457     JSClass<JSVideo>::StaticMethod("onDeleteEvent", &JSInteractableView::JsOnDelete);
458     JSClass<JSVideo>::StaticMethod("onClick", &JSInteractableView::JsOnClick);
459     JSClass<JSVideo>::StaticMethod("onAttach", &JSInteractableView::JsOnAttach);
460     JSClass<JSVideo>::StaticMethod("onAppear", &JSInteractableView::JsOnAppear);
461     JSClass<JSVideo>::StaticMethod("onDetach", &JSInteractableView::JsOnDetach);
462     JSClass<JSVideo>::StaticMethod("onDisAppear", &JSInteractableView::JsOnDisAppear);
463     JSClass<JSVideo>::StaticMethod("remoteMessage", &JSInteractableView::JsCommonRemoteMessage);
464     // override method
465     JSClass<JSVideo>::StaticMethod("opacity", &JSViewAbstract::JsOpacityPassThrough);
466     JSClass<JSVideo>::StaticMethod("transition", &JSViewAbstract::JsTransitionPassThrough);
467     JSClass<JSVideo>::InheritAndBind<JSViewAbstract>(globalObj);
468 }
469 
470 } // namespace OHOS::Ace::Framework
471