mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 09:32:38 +08:00
[v3.6] Don't rename webview& video c++ destuctor to destroy in webview/video.ini, add a 'destroy' method and bind it instead. (#11323)
* [v3.6] Don't rename webview& video c++ destuctor to destroy in webview/video.ini, add a 'destroy' method and bind it instead. * VideoPlayer doesn't need to be inherited from RefCounted. * Add final keyword for VideoPlayer & WebView.
This commit is contained in:
@@ -82,8 +82,21 @@ VideoPlayer::VideoPlayer()
|
||||
}
|
||||
|
||||
VideoPlayer::~VideoPlayer() {
|
||||
sAllVideoPlayers.erase(_videoPlayerIndex);
|
||||
JniHelper::callStaticVoidMethod(VIDEO_HELPER_CLASS_NAME, "removeVideoWidget", _videoPlayerIndex);
|
||||
destroy();
|
||||
}
|
||||
|
||||
void VideoPlayer::destroy() {
|
||||
if (_videoPlayerIndex != -1) {
|
||||
auto iter = sAllVideoPlayers.find(_videoPlayerIndex);
|
||||
if (iter != sAllVideoPlayers.end()) {
|
||||
sAllVideoPlayers.erase(iter);
|
||||
}
|
||||
|
||||
JniHelper::callStaticVoidMethod(VIDEO_HELPER_CLASS_NAME, "removeVideoWidget",
|
||||
_videoPlayerIndex);
|
||||
|
||||
_videoPlayerIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void VideoPlayer::setURL(const ccstd::string &videoUrl) {
|
||||
|
||||
Reference in New Issue
Block a user