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