Commit 4cc43555 authored by limingzhe's avatar limingzhe

feat: 首次提交

parent 3d36cbfc
No preview for this file type
export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
}
\ No newline at end of file
......@@ -14,7 +14,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url });
// this._audioResList.push({ url: this.data.audio_url });
this._audioResList.push({ url: this.data.video_url || '' });
}
addPreloadAnima() {
......@@ -35,12 +36,138 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
initView() {
this.initBg();
this.initPic();
this.setTransparentCanvas();
this.initVideo();
this.initBtn();
this.initIcon();
// this.initBg();
// this.initPic();
// this.initBtn();
// this.initIcon();
}
initBtn() {
const canvas = cc.find("Canvas");
const jumpBtn = cc.find("Canvas/btn_skip"); //this.getSprNode('btn_right');
canvas.on('touchstart', () => {
this.videoPlayEnd();
})
// jumpBtn.parent = canvas;
// jumpBtn.anchorX = 1;
// jumpBtn.anchorY = 1;
// jumpBtn.x = canvas.width / 2;
// jumpBtn.y = canvas.height / 2;
}
setTransparentCanvas() {
// 在main.js 加入以下代码:
// cc.macro.ENABLE_TRANSPARENT_CANVAS = true; //加在 cc.game.run(); 前面
// cc.director.setClearColor(new cc.Color(0,0,0, 0)); //加在cc.game.run(function); 回调里面
cc.Camera.main.backgroundColor = new cc.Color(0,0,0, 0);
// cc.game.canvas.style.backgroundColor = 'rgba(0, 0, 0, 0)'
cc.game.canvas.style.backgroundColor = 'transparent';
}
video = null
initVideo() {
// if (this.data.video_url) {
// this.initVideoRemote();
// } else {
this.initVideoLocal();
// }
this.video.node.on('completed', () => {
console.log(' in completed!!!!')
this.videoPlayEnd();
})
}
isPlayEnd = null
videoPlayEnd() {
if (this.isPlayEnd) {
return
}
this.isPlayEnd = true;
onHomeworkFinish();
}
initVideoLocal() {
console.log(' in initVideoLocal')
const videoLocalNode = cc.find("Canvas/videoBase/videoLocal");
const video = videoLocalNode.getComponent(cc.VideoPlayer);
video.isFullscreen = true;
// video.stayOnBottom = true;
console.log("video: ", video);
video.play();
this.video = video;
}
initVideoRemote() {
console.log(' in initVideoRemote')
const videoLocalNode = cc.find("Canvas/videoBase/videoLocal");
videoLocalNode.active = false;
const videoRemoteNode = new cc.Node();
videoRemoteNode.width = videoLocalNode.width;
videoRemoteNode.height = videoLocalNode.height;
videoRemoteNode.parent = videoLocalNode.parent;
const video = videoRemoteNode.addComponent(cc.VideoPlayer);
let isCanPlay = false;
const playVideo = ()=> {
if (isCanPlay) {
return;
}
isCanPlay = true;
video.play();
}
videoRemoteNode.on("meta-loaded", () => {
console.log('in meta-loaded')
playVideo();
})
videoRemoteNode.on("ready-to-play", () => {
console.log('in ready-to-play ');
playVideo();
})
video.resourceType = cc.VideoPlayer.ResourceType.REMOTE;
video.remoteURL = this.data.video_url;
video.isFullscreen = true;
video.stayOnBottom = true;
this.video = video;
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
......@@ -103,7 +230,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
curPage = null;
initBtn() {
initBtn_() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
......
export const defaultData = {"video_url":"http://staging-teach.cdn.ireadabc.com/31581cee2192077e91982eeb59d5ea5e.mp4"}
\ No newline at end of file
......@@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
cc.macro.ENABLE_TRANSPARENT_CANVAS = true;
cc.sys.capabilities["touches"] = true;
!(function (global) {
......
{
"ver": "1.1.2",
"uuid": "4f3da8ad-77d1-4da2-852d-3a18fd1cdbc9",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "b0b36a25-23fe-493b-a3f6-94f69c2ef41d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 146,
"height": 71,
"platformSettings": {},
"subMetas": {
"btn_skip": {
"ver": "1.0.4",
"uuid": "9473a150-ed7f-432e-96b3-41d0fbea4e95",
"rawTextureUuid": "b0b36a25-23fe-493b-a3f6-94f69c2ef41d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 146,
"height": 71,
"rawWidth": 146,
"rawHeight": 71,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "1df20370-4066-4fff-8085-efb8895be5af",
"subMetas": {}
}
\ No newline at end of file
......@@ -128,5 +128,8 @@
}
}
},
"defaultProject": "ng-template-generator"
}
"defaultProject": "ng-template-generator",
"cli": {
"analytics": false
}
}
\ No newline at end of file
......@@ -20,10 +20,10 @@
"@angular/platform-browser": "~9.0.2",
"@angular/platform-browser-dynamic": "~9.0.2",
"@angular/router": "~9.0.2",
"@fortawesome/angular-fontawesome": "^0.6.0",
"@fortawesome/fontawesome-svg-core": "^1.2.27",
"@fortawesome/free-regular-svg-icons": "^5.12.1",
"@fortawesome/free-solid-svg-icons": "^5.12.1",
"@fortawesome/angular-fontawesome": "0.6.0",
"@fortawesome/fontawesome-svg-core": "1.2.27",
"@fortawesome/free-regular-svg-icons": "5.12.1",
"@fortawesome/free-solid-svg-icons": "5.12.1",
"@tweenjs/tween.js": "~18.5.0",
"ali-oss": "^6.5.1",
"compressing": "^1.5.0",
......
<div class="model-content">
<div style="padding: 10px;">
<div style="width: 500px; margin: 20px">
<h3>上传视频:</h3>
<app-upload-video
(videoUploaded)="onVideoUploadSuccess($event)"
[item]="item"
[videoUrl]="item.video_url"></app-upload-video>
</div>
</div>
</div>
import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef } from '@angular/core';
import { JsonPipe } from '@angular/common';
@Component({
......@@ -63,6 +63,16 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
onVideoUploadSuccess(e) {
console.log('e: ', e);
this.item.video_url = e.url;
this.save();
}
/**
* 储存图片数据
* @param e
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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