Commit c15a4b45 authored by Tt's avatar Tt

待处理视频黑屏问题

parent 58f409d8
......@@ -242,7 +242,7 @@
"r": 0,
"g": 0,
"b": 0,
"a": 0
"a": 255
},
"_depth": -1,
"_zoomRatio": 1,
......@@ -265,7 +265,7 @@
},
{
"__type__": "cc.Node",
"_name": "item_color",
"_name": "video_node",
"_objFlags": 0,
"_parent": {
"__id__": 2
......@@ -282,14 +282,14 @@
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 0,
"b": 0,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 10,
"height": 10
"width": 1920,
"height": 780
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -300,8 +300,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-2813.619,
1086.447,
0,
0,
0,
0,
0,
......@@ -323,49 +323,37 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "f0C25UHZBAeJERsF9wxSs6"
"_id": "e4OwB0Br9B4pxzNBT8RuYr"
},
{
"__type__": "cc.Sprite",
"__type__": "cc.VideoPlayer",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "04k5a2U7pCl7Db18cpGWAZ"
"_resourceType": 0,
"_remoteURL": "",
"_clip": null,
"_volume": 1,
"_mute": false,
"_isFullscreen": false,
"_N$isFullscreen": false,
"_stayOnBottom": false,
"videoPlayerEvent": [],
"_N$keepAspectRatio": true,
"_id": "29CCXhUYNFUKGvY0Xyr4dn"
},
{
"__type__": "cc.Node",
"_name": "video_node",
"_name": "item_color",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 8
......@@ -376,14 +364,14 @@
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1000,
"height": 600
"width": 10,
"height": 10
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -394,8 +382,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
-5196.038,
1558.213,
0,
0,
0,
......@@ -417,27 +405,39 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e4OwB0Br9B4pxzNBT8RuYr"
"_id": "f0C25UHZBAeJERsF9wxSs6"
},
{
"__type__": "cc.VideoPlayer",
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"_resourceType": 0,
"_remoteURL": "",
"_clip": null,
"_volume": 1,
"_mute": false,
"_isFullscreen": false,
"_N$isFullscreen": false,
"_stayOnBottom": true,
"videoPlayerEvent": [],
"_N$keepAspectRatio": true,
"_id": "29CCXhUYNFUKGvY0Xyr4dn"
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_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",
......@@ -3257,7 +3257,7 @@
"__id__": 69
}
],
"_active": true,
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
......@@ -5209,7 +5209,7 @@
"__id__": 113
}
],
"_active": true,
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
......@@ -6209,7 +6209,7 @@
"__id__": 70
},
"videoPlayer": {
"__id__": 8
"__id__": 6
},
"currentTimeLabel": {
"__id__": 92
......
......@@ -27,6 +27,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(dg_xiaodi) xiaodi: dg_xiaodi = null;
async onLoadEnd() {
this.initVideoPlayer();
this.showVideoPlayer();
return;
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
......@@ -276,36 +279,39 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Label) currentTimeLabel: cc.Label = null;
private _isReadyToPlay: boolean;
showVideoPlayer() {
cc.macro.ENABLE_TRANSPARENT_CANVAS = true
this.videoPlayer.stayOnBottom = true;
// this.videoPlayer.stayOnBottom = true;
// this._isReadyToPlay = false;
// this.videoPlayer.node.x = -5000;
// this.videoPlayer.node.y = -5000;
this.videoPlayer.remoteURL = this.data.video;
// this.play();
this.time1 = setTimeout(() => {
this.videoPlayer.stayOnBottom = false;
cc.find(`Canvas/Controls`).active = false;
setTimeout(() => {
this.videoPlayer.stayOnBottom = true;
}, 3000);
// this.time1 = setTimeout(() => {
// this.videoPlayer.stayOnBottom = false;
// cc.find(`Canvas/Controls`).active = false;
// }, 500);
}
// private _isPlayComplated
initVideoPlayer() {
this.videoPlayer.node.on('ready-to-play', () => {
// console.log('ready-to-play');
console.log('ready-to-play');
// 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._isReadyToPlay = true;
// this._isPlayComplated = false;
// this.videoPlayer.currentTime = 0;
// // this.videoPlayer.resume();
// this.play();
this._isReadyToPlay = true;
this._isPlayComplated = false;
this.videoPlayer.currentTime = 0;
// this.videoPlayer.resume();
this.play();
});
this.videoPlayer.node.on('meta-loaded', () => {
console.log('meta-loaded');
......@@ -478,17 +484,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (!this._isReadyToPlay) {
return;
}
const { width, height } = cc.find(`Canvas/bg`);
cc.find(`Canvas/text_tips`).active = false;
cc.find(`Canvas/bg`).active = false;
cc.find(`Canvas/bgwhite`).active = false;
cc.find(`Canvas/bg_video_shadow`).active = false;
// const { width, height } = cc.find(`Canvas/bg`);
// cc.find(`Canvas/text_tips`).active = false;
// cc.find(`Canvas/bg`).active = false;
// cc.find(`Canvas/bgwhite`).active = false;
// cc.find(`Canvas/bg_video_shadow`).active = false;
const videoContainer = cc.find('Canvas/video_node');
cc.find('bg', videoContainer).width = width;
cc.find('bg', videoContainer).height = height;
this.videoPlayer.node.x = videoContainer.x;
this.videoPlayer.node.y = videoContainer.y;
// const videoContainer = cc.find('Canvas/video_node');
// cc.find('bg', videoContainer).width = width;
// cc.find('bg', videoContainer).height = height;
// this.videoPlayer.node.x = videoContainer.x;
// this.videoPlayer.node.y = videoContainer.y;
this.videoPlayer.play();
}
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 =
"npcAudioName": "",
"npcAudioEnd": "http://staging-teach.cdn.ireadabc.com/85e58ae784dfc381170ddabead16cac6_l.mp3",
"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": [
{
......
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