[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:
James Chen
2022-06-02 15:01:57 +08:00
committed by GitHub
parent 61a3b74742
commit ae0ca842e5
12 changed files with 231 additions and 68 deletions
@@ -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) {