Commit fafe14e5 authored by Tt's avatar Tt

修改视频加载方式

parent 8903d1c1
{"ver":"1.1.2","uuid":"d2c00954-06de-4c50-ba53-cd2e7ec614fc","isBundle":true,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":true,"android":true},"subMetas":{}}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "d2c00954-06de-4c50-ba53-cd2e7ec614fc",
"isBundle": true,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": true,
"android": true
},
"subMetas": {}
}
\ No newline at end of file
......@@ -97,18 +97,21 @@
},
{
"__id__": 96
},
{
"__id__": 116
}
],
"_active": true,
"_components": [
{
"__id__": 116
"__id__": 118
},
{
"__id__": 117
"__id__": 119
},
{
"__id__": 118
"__id__": 120
}
],
"_prefab": null,
......@@ -5344,6 +5347,95 @@
"preload": false,
"_id": "07vNH/g39C7LNy2dhk07d+"
},
{
"__type__": "cc.Node",
"_name": "touch_layer",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 117
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1920,
"height": 1080
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "2dSVw+wY1H/o1H+4i08TP2"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 116
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "d41xNzt1RLRpYfDzpeOkmt"
},
{
"__type__": "cc.Canvas",
"_name": "",
......@@ -5438,6 +5530,9 @@
"currentTimeLabel": {
"__id__": 88
},
"touchlayer": {
"__id__": 116
},
"layout_video": {
"__id__": 76
},
......
......@@ -305,6 +305,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Label) currentTimeLabel: cc.Label = null;
@property(cc.Node) touchlayer: cc.Node = null;
@property(cc.Node) layout_video: cc.Node = null;
@property(cc.Node) videoControls: cc.Node = null;
@property(cc.Node) pauseButton: cc.Node = null;
......@@ -353,16 +354,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (!this._isReadyToPlay) {
//首次播放
this._isReadyToPlay = false;
this.videoPlayer.remoteURL = this.data.video;
// this.videoPlayer.remoteURL = this.data.video;
pg.view.touchOn(this.playButton, this.play, this);
pg.view.touchOn(this.pauseButton, this.pause, this);
} else {
}
//重复播放
this.videoPlayer.currentTime = 0;
this._isPlayComplated = false;
this.play();
}
this.scheduleOnce(() => {
if (!this.node) return;
if (!this.videoPlayer) return;
......@@ -390,12 +391,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.layout_video.active = false;
this.showUI();
}
@property(cc.Node) touchlayer : cc.Node = null;
initVideoUrl() {
this.prepared = true;
this.touchlayer.on(cc.Node.EventType.TOUCH_START, this.tryPlayVideo, this)
this.touchlayer._touchListener.setSwallowTouches(false)
this.videoPlayer.node.active = true;
this.videoPlayer.remoteURL = this.data.video_url;
this.videoPlayer.remoteURL = this.data.video;
this.videoPlayer.resourceType = cc.VideoPlayer.ResourceType.REMOTE;
}
private prepared: boolean;
......@@ -413,6 +414,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
initVideoPlayer() {
this.initVideoUrl();
this.videoPlayer.node.x = -10000;
this.videoPlayer.node.y = -10000;
this.layout_video.active = false;
......
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