Skip to content

Commit

Permalink
Fix the problem that the simulator reports errors and the real machin…
Browse files Browse the repository at this point in the history
…e does not display video on the Douyin mini game platform (#18077)

* Fix the problem that the simulator reports errors and the real machine does not display video on the Douyin mini game platform

---------

Co-authored-by: qiuguohua <[email protected]>
  • Loading branch information
qiuguohua and qiuguohua authored Dec 25, 2024
1 parent 08b5221 commit 396c31f
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ if (cc.internal.VideoPlayer) {
super(componenet);
this.videoNode = new cc.Node();
this.videoNode.addComponent(cc.Sprite);
this.videoNode.layer = this._node.layer;
this._node.insertChild(this.videoNode, 0);
}

Expand Down Expand Up @@ -162,17 +163,21 @@ if (cc.internal.VideoPlayer) {
}

setURL (path) {
const video = this._video;
const self = this;
const video = self._video;
if (!video || video.src === path) {
return;
}
video.stop();
this._unbindEvent();

if (self._playing) {
video.stop();
}
self._unbindEvent();
video.autoplay = true;
video.src = path;
video.muted = true;
const self = this;
this._loaded = false;

self._loaded = false;
function loadedCallback () {
self._bindEvent();
video.muted = false;
Expand Down

0 comments on commit 396c31f

Please sign in to comment.