Commit c15a4b45 authored by Tt's avatar Tt

待处理视频黑屏问题

parent 58f409d8
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
"r": 0, "r": 0,
"g": 0, "g": 0,
"b": 0, "b": 0,
"a": 0 "a": 255
}, },
"_depth": -1, "_depth": -1,
"_zoomRatio": 1, "_zoomRatio": 1,
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "item_color", "_name": "video_node",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
...@@ -282,14 +282,14 @@ ...@@ -282,14 +282,14 @@
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 255,
"g": 0, "g": 255,
"b": 0, "b": 255,
"a": 255 "a": 255
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 10, "width": 1920,
"height": 10 "height": 780
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -300,8 +300,8 @@ ...@@ -300,8 +300,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-2813.619, 0,
1086.447, 0,
0, 0,
0, 0,
0, 0,
...@@ -323,49 +323,37 @@ ...@@ -323,49 +323,37 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "f0C25UHZBAeJERsF9wxSs6" "_id": "e4OwB0Br9B4pxzNBT8RuYr"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.VideoPlayer",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 5 "__id__": 5
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_resourceType": 0,
{ "_remoteURL": "",
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" "_clip": null,
} "_volume": 1,
], "_mute": false,
"_srcBlendFactor": 770, "_isFullscreen": false,
"_dstBlendFactor": 771, "_N$isFullscreen": false,
"_spriteFrame": { "_stayOnBottom": false,
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" "videoPlayerEvent": [],
}, "_N$keepAspectRatio": true,
"_type": 0, "_id": "29CCXhUYNFUKGvY0Xyr4dn"
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "04k5a2U7pCl7Db18cpGWAZ"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "video_node", "_name": "item_color",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 8 "__id__": 8
...@@ -376,14 +364,14 @@ ...@@ -376,14 +364,14 @@
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 255,
"g": 255, "g": 0,
"b": 255, "b": 0,
"a": 255 "a": 255
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1000, "width": 10,
"height": 600 "height": 10
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -394,8 +382,8 @@ ...@@ -394,8 +382,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, -5196.038,
0, 1558.213,
0, 0,
0, 0,
0, 0,
...@@ -417,27 +405,39 @@ ...@@ -417,27 +405,39 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "e4OwB0Br9B4pxzNBT8RuYr" "_id": "f0C25UHZBAeJERsF9wxSs6"
}, },
{ {
"__type__": "cc.VideoPlayer", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 7 "__id__": 7
}, },
"_enabled": true, "_enabled": true,
"_resourceType": 0, "_materials": [
"_remoteURL": "", {
"_clip": null, "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
"_volume": 1, }
"_mute": false, ],
"_isFullscreen": false, "_srcBlendFactor": 770,
"_N$isFullscreen": false, "_dstBlendFactor": 771,
"_stayOnBottom": true, "_spriteFrame": {
"videoPlayerEvent": [], "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
"_N$keepAspectRatio": true, },
"_id": "29CCXhUYNFUKGvY0Xyr4dn" "_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "04k5a2U7pCl7Db18cpGWAZ"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
...@@ -3257,7 +3257,7 @@ ...@@ -3257,7 +3257,7 @@
"__id__": 69 "__id__": 69
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
...@@ -5209,7 +5209,7 @@ ...@@ -5209,7 +5209,7 @@
"__id__": 113 "__id__": 113
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
...@@ -6209,7 +6209,7 @@ ...@@ -6209,7 +6209,7 @@
"__id__": 70 "__id__": 70
}, },
"videoPlayer": { "videoPlayer": {
"__id__": 8 "__id__": 6
}, },
"currentTimeLabel": { "currentTimeLabel": {
"__id__": 92 "__id__": 92
......
...@@ -27,6 +27,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -27,6 +27,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(dg_xiaodi) xiaodi: dg_xiaodi = null; @property(dg_xiaodi) xiaodi: dg_xiaodi = null;
async onLoadEnd() { async onLoadEnd() {
this.initVideoPlayer();
this.showVideoPlayer();
return;
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考 // TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData(); this.initData();
this.initView(); this.initView();
...@@ -276,36 +279,39 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -276,36 +279,39 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Label) currentTimeLabel: cc.Label = null; @property(cc.Label) currentTimeLabel: cc.Label = null;
private _isReadyToPlay: boolean; private _isReadyToPlay: boolean;
showVideoPlayer() { showVideoPlayer() {
cc.macro.ENABLE_TRANSPARENT_CANVAS = true // this.videoPlayer.stayOnBottom = true;
this.videoPlayer.stayOnBottom = true;
// this._isReadyToPlay = false; // this._isReadyToPlay = false;
// this.videoPlayer.node.x = -5000; // this.videoPlayer.node.x = -5000;
// this.videoPlayer.node.y = -5000; // this.videoPlayer.node.y = -5000;
this.videoPlayer.remoteURL = this.data.video; this.videoPlayer.remoteURL = this.data.video;
// this.play();
this.time1 = setTimeout(() => { setTimeout(() => {
this.videoPlayer.stayOnBottom = false; this.videoPlayer.stayOnBottom = true;
cc.find(`Canvas/Controls`).active = false;
}, 3000); }, 3000);
// this.time1 = setTimeout(() => {
// this.videoPlayer.stayOnBottom = false;
// cc.find(`Canvas/Controls`).active = false;
// }, 500);
} }
// private _isPlayComplated // private _isPlayComplated
initVideoPlayer() { initVideoPlayer() {
this.videoPlayer.node.on('ready-to-play', () => { this.videoPlayer.node.on('ready-to-play', () => {
// console.log('ready-to-play'); console.log('ready-to-play');
// this.playButton.active = true; // this.playButton.active = true;
// cc.find(`Canvas/bg_video_shadow`).active = false;
// cc.find(`Canvas/loading`).active = false;
// this.durationLabel.string = this.formatTime(this.videoPlayer.getDuration()); // this.durationLabel.string = this.formatTime(this.videoPlayer.getDuration());
// this._isReadyToPlay = true; this._isReadyToPlay = true;
// this._isPlayComplated = false; this._isPlayComplated = false;
// this.videoPlayer.currentTime = 0; this.videoPlayer.currentTime = 0;
// // this.videoPlayer.resume(); // this.videoPlayer.resume();
// this.play(); this.play();
}); });
this.videoPlayer.node.on('meta-loaded', () => { this.videoPlayer.node.on('meta-loaded', () => {
console.log('meta-loaded'); console.log('meta-loaded');
...@@ -478,17 +484,17 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -478,17 +484,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (!this._isReadyToPlay) { if (!this._isReadyToPlay) {
return; return;
} }
const { width, height } = cc.find(`Canvas/bg`); // const { width, height } = cc.find(`Canvas/bg`);
cc.find(`Canvas/text_tips`).active = false; // cc.find(`Canvas/text_tips`).active = false;
cc.find(`Canvas/bg`).active = false; // cc.find(`Canvas/bg`).active = false;
cc.find(`Canvas/bgwhite`).active = false; // cc.find(`Canvas/bgwhite`).active = false;
cc.find(`Canvas/bg_video_shadow`).active = false; // cc.find(`Canvas/bg_video_shadow`).active = false;
const videoContainer = cc.find('Canvas/video_node'); // const videoContainer = cc.find('Canvas/video_node');
cc.find('bg', videoContainer).width = width; // cc.find('bg', videoContainer).width = width;
cc.find('bg', videoContainer).height = height; // cc.find('bg', videoContainer).height = height;
this.videoPlayer.node.x = videoContainer.x; // this.videoPlayer.node.x = videoContainer.x;
this.videoPlayer.node.y = videoContainer.y; // this.videoPlayer.node.y = videoContainer.y;
this.videoPlayer.play(); this.videoPlayer.play();
} }
pause() { pause() {
......
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
onLoad() {
cc.macro.ENABLE_TRANSPARENT_CANVAS = true
}
start() {
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "5b9a97a8-26db-46ba-90c9-a2076584efc0",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -5,7 +5,8 @@ export const defaultData = ...@@ -5,7 +5,8 @@ export const defaultData =
"npcAudioName": "", "npcAudioName": "",
"npcAudioEnd": "http://staging-teach.cdn.ireadabc.com/85e58ae784dfc381170ddabead16cac6_l.mp3", "npcAudioEnd": "http://staging-teach.cdn.ireadabc.com/85e58ae784dfc381170ddabead16cac6_l.mp3",
"npcAudioEndName": "", "npcAudioEndName": "",
"video": "http://staging-teach.cdn.ireadabc.com/aca65e37c239f95496a8c39fe1374fc4.mp4", // "video": "http://staging-teach.cdn.ireadabc.com/aca65e37c239f95496a8c39fe1374fc4.mp4",
"video": "http://staging-teach.cdn.ireadabc.com/c37a3945121274a1f7d95717327539ec.mp4",
"questions": [ "questions": [
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment