Commit 61c13b34 authored by 李维's avatar 李维

优化全屏进度条

parent 121122e9
......@@ -93,31 +93,31 @@
"__id__": 81
},
{
"__id__": 133
"__id__": 139
},
{
"__id__": 171
"__id__": 177
},
{
"__id__": 182
"__id__": 188
},
{
"__id__": 185
"__id__": 191
},
{
"__id__": 187
"__id__": 193
}
],
"_active": true,
"_components": [
{
"__id__": 189
"__id__": 195
},
{
"__id__": 190
"__id__": 196
},
{
"__id__": 191
"__id__": 197
}
],
"_prefab": null,
......@@ -3627,15 +3627,18 @@
},
{
"__id__": 96
},
{
"__id__": 131
}
],
"_active": true,
"_components": [
{
"__id__": 131
"__id__": 137
},
{
"__id__": 132
"__id__": 138
}
],
"_prefab": null,
......@@ -3661,7 +3664,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-9000,
-9999,
0,
0,
0,
......@@ -5941,6 +5944,290 @@
"_originalHeight": 0,
"_id": "fbKtfLRTVLcZPBiawa64xA"
},
{
"__type__": "cc.Node",
"_name": "center",
"_objFlags": 0,
"_parent": {
"__id__": 81
},
"_children": [
{
"__id__": 132
},
{
"__id__": 135
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 400,
"height": 150
},
"_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": "b4dRB85ThAj5axmwu5wQBs"
},
{
"__type__": "cc.Node",
"_name": "color_bg",
"_objFlags": 0,
"_parent": {
"__id__": 131
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 133
},
{
"__id__": 134
}
],
"_prefab": null,
"_opacity": 180,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 400,
"height": 150
},
"_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": "a07Jr5DddAo7l9/dFd+M9N"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 132
},
"_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": "d3ugRes+JBhLAkWBpVaecF"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 132
},
"_enabled": true,
"alignMode": 1,
"_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": 100,
"_originalHeight": 100,
"_id": "d3HzceU+tASrRCWsgGBAhP"
},
{
"__type__": "cc.Node",
"_name": "text",
"_objFlags": 0,
"_parent": {
"__id__": 131
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 136
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 126
},
"_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": "eeKuopoGtJtrITlOeltFNj"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 135
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_fontSize": 40,
"_lineHeight": 100,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "88A+87hx1OyJp/xJJLZIaY"
},
{
"__type__": "cc.Widget",
"_name": "",
......@@ -5952,8 +6239,8 @@
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": -9000,
"_right": 9000,
"_left": -9999,
"_right": 9999,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
......@@ -6004,6 +6291,9 @@
"endTime": {
"__id__": 121
},
"centerInfo": {
"__id__": 131
},
"_id": "31vAPhl1xCbb7SgXfkJ5yi"
},
{
......@@ -6015,16 +6305,16 @@
},
"_children": [
{
"__id__": 134
"__id__": 140
}
],
"_active": true,
"_components": [
{
"__id__": 169
"__id__": 175
},
{
"__id__": 170
"__id__": 176
}
],
"_prefab": null,
......@@ -6080,17 +6370,17 @@
"_name": "view",
"_objFlags": 0,
"_parent": {
"__id__": 133
"__id__": 139
},
"_children": [
{
"__id__": 135
"__id__": 141
}
],
"_active": true,
"_components": [
{
"__id__": 168
"__id__": 174
}
],
"_prefab": null,
......@@ -6146,17 +6436,17 @@
"_name": "content",
"_objFlags": 0,
"_parent": {
"__id__": 134
"__id__": 140
},
"_children": [
{
"__id__": 136
"__id__": 142
}
],
"_active": true,
"_components": [
{
"__id__": 167
"__id__": 173
}
],
"_prefab": null,
......@@ -6212,20 +6502,20 @@
"_name": "item",
"_objFlags": 0,
"_parent": {
"__id__": 135
"__id__": 141
},
"_children": [
{
"__id__": 137
"__id__": 143
},
{
"__id__": 151
"__id__": 157
}
],
"_active": false,
"_components": [
{
"__id__": 165
"__id__": 171
}
],
"_prefab": null,
......@@ -6281,29 +6571,29 @@
"_name": "item",
"_objFlags": 0,
"_parent": {
"__id__": 136
"__id__": 142
},
"_children": [
{
"__id__": 138
"__id__": 144
},
{
"__id__": 140
"__id__": 146
},
{
"__id__": 144
"__id__": 150
},
{
"__id__": 146
"__id__": 152
},
{
"__id__": 148
"__id__": 154
}
],
"_active": true,
"_components": [
{
"__id__": 150
"__id__": 156
}
],
"_prefab": null,
......@@ -6359,13 +6649,13 @@
"_name": "cover_bg",
"_objFlags": 0,
"_parent": {
"__id__": 137
"__id__": 143
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 139
"__id__": 145
}
],
"_prefab": null,
......@@ -6421,7 +6711,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 138
"__id__": 144
},
"_enabled": true,
"_materials": [
......@@ -6453,17 +6743,17 @@
"_name": "mask",
"_objFlags": 0,
"_parent": {
"__id__": 137
"__id__": 143
},
"_children": [
{
"__id__": 141
"__id__": 147
}
],
"_active": true,
"_components": [
{
"__id__": 143
"__id__": 149
}
],
"_prefab": null,
......@@ -6519,13 +6809,13 @@
"_name": "cover",
"_objFlags": 0,
"_parent": {
"__id__": 140
"__id__": 146
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 142
"__id__": 148
}
],
"_prefab": null,
......@@ -6581,7 +6871,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 141
"__id__": 147
},
"_enabled": true,
"_materials": [
......@@ -6613,7 +6903,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 140
"__id__": 146
},
"_enabled": true,
"_materials": [
......@@ -6635,13 +6925,13 @@
"_name": "num",
"_objFlags": 0,
"_parent": {
"__id__": 137
"__id__": 143
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 145
"__id__": 151
}
],
"_prefab": null,
......@@ -6697,7 +6987,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 144
"__id__": 150
},
"_enabled": true,
"_materials": [
......@@ -6732,13 +7022,13 @@
"_name": "title",
"_objFlags": 0,
"_parent": {
"__id__": 137
"__id__": 143
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 147
"__id__": 153
}
],
"_prefab": null,
......@@ -6794,7 +7084,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 146
"__id__": 152
},
"_enabled": true,
"_materials": [
......@@ -6827,13 +7117,13 @@
"_name": "color",
"_objFlags": 0,
"_parent": {
"__id__": 137
"__id__": 143
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 149
"__id__": 155
}
],
"_prefab": null,
......@@ -6889,7 +7179,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 148
"__id__": 154
},
"_enabled": true,
"_materials": [],
......@@ -6917,7 +7207,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 137
"__id__": 143
},
"_enabled": true,
"_materials": [
......@@ -6949,29 +7239,29 @@
"_name": "item_active",
"_objFlags": 0,
"_parent": {
"__id__": 136
"__id__": 142
},
"_children": [
{
"__id__": 152
"__id__": 158
},
{
"__id__": 154
"__id__": 160
},
{
"__id__": 156
"__id__": 162
},
{
"__id__": 158
"__id__": 164
},
{
"__id__": 162
"__id__": 168
}
],
"_active": false,
"_components": [
{
"__id__": 164
"__id__": 170
}
],
"_prefab": null,
......@@ -7027,13 +7317,13 @@
"_name": "cover_bg",
"_objFlags": 0,
"_parent": {
"__id__": 151
"__id__": 157
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 153
"__id__": 159
}
],
"_prefab": null,
......@@ -7089,7 +7379,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 152
"__id__": 158
},
"_enabled": true,
"_materials": [
......@@ -7121,13 +7411,13 @@
"_name": "num",
"_objFlags": 0,
"_parent": {
"__id__": 151
"__id__": 157
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 155
"__id__": 161
}
],
"_prefab": null,
......@@ -7183,7 +7473,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 154
"__id__": 160
},
"_enabled": true,
"_materials": [
......@@ -7218,13 +7508,13 @@
"_name": "img_audio_ske",
"_objFlags": 0,
"_parent": {
"__id__": 151
"__id__": 157
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 157
"__id__": 163
}
],
"_prefab": null,
......@@ -7280,7 +7570,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 156
"__id__": 162
},
"_enabled": true,
"_materials": [
......@@ -7320,17 +7610,17 @@
"_name": "mask",
"_objFlags": 0,
"_parent": {
"__id__": 151
"__id__": 157
},
"_children": [
{
"__id__": 159
"__id__": 165
}
],
"_active": true,
"_components": [
{
"__id__": 161
"__id__": 167
}
],
"_prefab": null,
......@@ -7386,13 +7676,13 @@
"_name": "cover",
"_objFlags": 0,
"_parent": {
"__id__": 158
"__id__": 164
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 160
"__id__": 166
}
],
"_prefab": null,
......@@ -7448,7 +7738,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 159
"__id__": 165
},
"_enabled": true,
"_materials": [
......@@ -7480,7 +7770,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 158
"__id__": 164
},
"_enabled": true,
"_materials": [
......@@ -7502,13 +7792,13 @@
"_name": "title",
"_objFlags": 0,
"_parent": {
"__id__": 151
"__id__": 157
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 163
"__id__": 169
}
],
"_prefab": null,
......@@ -7564,7 +7854,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 162
"__id__": 168
},
"_enabled": true,
"_materials": [
......@@ -7597,7 +7887,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 151
"__id__": 157
},
"_enabled": true,
"_materials": [
......@@ -7629,7 +7919,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 136
"__id__": 142
},
"_enabled": true,
"_normalMaterial": null,
......@@ -7638,7 +7928,7 @@
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 166
"__id__": 172
}
],
"_N$interactable": true,
......@@ -7694,7 +7984,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 136
"__id__": 142
},
"_id": "7aTx3B2HJO6oViYBGBm/73"
},
......@@ -7713,7 +8003,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 135
"__id__": 141
},
"_enabled": true,
"_layoutSize": {
......@@ -7745,7 +8035,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 134
"__id__": 140
},
"_enabled": true,
"_materials": [
......@@ -7765,7 +8055,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 133
"__id__": 139
},
"_enabled": true,
"_materials": [
......@@ -7795,7 +8085,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 133
"__id__": 139
},
"_enabled": true,
"horizontal": true,
......@@ -7807,10 +8097,10 @@
"scrollEvents": [],
"cancelInnerEvents": true,
"_N$content": {
"__id__": 135
"__id__": 141
},
"content": {
"__id__": 135
"__id__": 141
},
"_N$horizontalScrollBar": null,
"_N$verticalScrollBar": null,
......@@ -7825,10 +8115,10 @@
},
"_children": [
{
"__id__": 172
"__id__": 178
},
{
"__id__": 177
"__id__": 183
}
],
"_active": true,
......@@ -7886,19 +8176,19 @@
"_name": "btn_last",
"_objFlags": 0,
"_parent": {
"__id__": 171
"__id__": 177
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 173
"__id__": 179
},
{
"__id__": 174
"__id__": 180
},
{
"__id__": 176
"__id__": 182
}
],
"_prefab": null,
......@@ -7954,7 +8244,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 172
"__id__": 178
},
"_enabled": true,
"_materials": [
......@@ -7986,7 +8276,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 172
"__id__": 178
},
"_enabled": true,
"_normalMaterial": null,
......@@ -7995,7 +8285,7 @@
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 175
"__id__": 181
}
],
"_N$interactable": true,
......@@ -8051,7 +8341,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 172
"__id__": 178
},
"_id": "63sqlR0bVEJrqaAhyT+FzF"
},
......@@ -8070,7 +8360,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 172
"__id__": 178
},
"_enabled": true,
"alignMode": 1,
......@@ -8099,19 +8389,19 @@
"_name": "btn_next",
"_objFlags": 0,
"_parent": {
"__id__": 171
"__id__": 177
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 178
"__id__": 184
},
{
"__id__": 179
"__id__": 185
},
{
"__id__": 181
"__id__": 187
}
],
"_prefab": null,
......@@ -8167,7 +8457,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 177
"__id__": 183
},
"_enabled": true,
"_materials": [
......@@ -8199,7 +8489,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 177
"__id__": 183
},
"_enabled": true,
"_normalMaterial": null,
......@@ -8208,7 +8498,7 @@
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 180
"__id__": 186
}
],
"_N$interactable": true,
......@@ -8264,7 +8554,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 177
"__id__": 183
},
"_id": "3aZJp/FzlONJO+/okrPRip"
},
......@@ -8283,7 +8573,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 177
"__id__": 183
},
"_enabled": true,
"alignMode": 1,
......@@ -8318,10 +8608,10 @@
"_active": true,
"_components": [
{
"__id__": 183
"__id__": 189
},
{
"__id__": 184
"__id__": 190
}
],
"_prefab": null,
......@@ -8377,7 +8667,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 182
"__id__": 188
},
"_enabled": true,
"_materials": [
......@@ -8410,7 +8700,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 182
"__id__": 188
},
"_enabled": true,
"alignMode": 1,
......@@ -8443,7 +8733,7 @@
"_active": false,
"_components": [
{
"__id__": 186
"__id__": 192
}
],
"_prefab": null,
......@@ -8499,7 +8789,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 185
"__id__": 191
},
"_enabled": true,
"_materials": [
......@@ -8537,7 +8827,7 @@
"_active": false,
"_components": [
{
"__id__": 188
"__id__": 194
}
],
"_prefab": null,
......@@ -8593,7 +8883,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 187
"__id__": 193
},
"_enabled": true,
"_materials": [
......@@ -8710,7 +9000,7 @@
"__id__": 39
},
"loadingSprite": {
"__id__": 187
"__id__": 193
},
"noPlayCover": {
"__id__": 33
......
......@@ -163,45 +163,25 @@ export default class VideoPlayerComponent extends cc.Component {
this.videoPlayer.node.on('clicked', () => {
if (this.isVideoFull) {
this.videoPlayer.stayOnBottom = true;
this.fullscreenVideoControls.emit("show");
if (this.time1) {
clearTimeout(this.time1);
}
this.time1 = setTimeout(() => {
this.videoPlayer.stayOnBottom = false;
this.fullscreenVideoControls.emit("hide");
}, 6000);
this.videoPlayer.stayOnBottom = true;
}
});
this.videoPlayer.node.on('touchstarted', () => {
console.log('touchstarted');
if (this.isVideoFull) {
this.videoPlayer.stayOnBottom = true;
this.fullscreenVideoControls.emit("show");
if (this.time1) {
clearTimeout(this.time1);
}
this.time1 = setTimeout(() => {
this.videoPlayer.stayOnBottom = false;
this.fullscreenVideoControls.emit("hide");
}, 6000);
this.videoPlayer.stayOnBottom = true;
}
});
this.videoPlayer.node.on(cc.Node.EventType.TOUCH_START, () => {
console.log('touchstarted');
if (this.isVideoFull) {
this.videoPlayer.stayOnBottom = true;
this.fullscreenVideoControls.emit("show");
if (this.time1) {
clearTimeout(this.time1);
}
this.time1 = setTimeout(() => {
this.videoPlayer.stayOnBottom = false;
this.fullscreenVideoControls.emit("hide");
}, 6000);
this.videoPlayer.stayOnBottom = true;
}
});
......@@ -256,6 +236,7 @@ export default class VideoPlayerComponent extends cc.Component {
}
}
// 初始化全屏视频控制条
initFullScreenControls() {
this.fullscreenVideoControls.on("play", ()=>{
this.play()
......@@ -263,6 +244,9 @@ export default class VideoPlayerComponent extends cc.Component {
this.fullscreenVideoControls.on("pause", ()=>{
this.pause()
})
this.fullscreenVideoControls.on("hide", ()=>{
this.videoPlayer.stayOnBottom = false;
})
this.fullscreenVideoControls.on("exit_fullscreen", ()=>{
this.exitFullScreen()
})
......@@ -270,6 +254,10 @@ export default class VideoPlayerComponent extends cc.Component {
const {percent} = opt;
const dur = this.videoPlayer.getDuration();
this.videoPlayer.currentTime = percent * dur;
this.fullscreenVideoControls.emit("tips", {
startTime: this.videoPlayer.currentTime,
endTime: dur
})
})
this.fullscreenVideoControls.on("switch_clarity", (clarity="h")=>{
......@@ -493,6 +481,7 @@ export default class VideoPlayerComponent extends cc.Component {
}
this.initListener();
this.initFullScreenControls();
this.videoPlayer.stayOnBottom = true;
}
updateBarByPos(newX: number) {
......@@ -579,6 +568,7 @@ export default class VideoPlayerComponent extends cc.Component {
play() {
if (!this._isReadyToPlay) {
console.log("视频还未准备好")
return;
}
......@@ -605,6 +595,7 @@ export default class VideoPlayerComponent extends cc.Component {
}
backward() {
}
replay() {
......@@ -619,7 +610,6 @@ export default class VideoPlayerComponent extends cc.Component {
cc.audioEngine.playEffect(audio.clip, false);
}
time1: any = null;
isVideoFull: boolean = false;
tempPos: any = null;
......@@ -637,6 +627,7 @@ export default class VideoPlayerComponent extends cc.Component {
this.showHideMiddleLayerBackBtn(false);
this.isVideoFull = true;
this.fullscreenVideoControls.emit("show");
this.videoPlayer.stayOnBottom = true;
this.videoControls.active = false;
cc.find(`Canvas/title`).active = false;
cc.find('Canvas/pageButton').active = false;
......@@ -647,7 +638,6 @@ export default class VideoPlayerComponent extends cc.Component {
})
}, 1);
this.videoPlayer.stayOnBottom = true;
const videoContainer = cc.find('Canvas/video_node');
this.tempPos.videoPos = {
x: videoContainer.x,
......@@ -670,11 +660,7 @@ export default class VideoPlayerComponent extends cc.Component {
const videoNode = cc.find("Canvas/VideoNode");
const widget = videoNode.getComponent(cc.Widget)
widget.enabled = true;
this.time1 = setTimeout(() => {
this.videoPlayer.stayOnBottom = false;
}, 3000);
widget.enabled = true;
}
exitFullScreen() {
......@@ -686,10 +672,6 @@ export default class VideoPlayerComponent extends cc.Component {
this.showHideMiddleLayerBackBtn(true);
// 标记退出全屏
this.isVideoFull = false;
// 取消视频在最底部
this.videoPlayer.stayOnBottom = false;
// 隐藏全屏视频控制条
this.fullscreenVideoControls.emit("hide");
// 显示正常视频控制条
this.videoControls.active = true;
// 显示全屏按钮
......@@ -731,15 +713,9 @@ export default class VideoPlayerComponent extends cc.Component {
controlBg.opacity = 255;
controlBg.width = 1259;
if (this.time1) {
clearTimeout(this.time1);
}
}
onDestroy() {
if (this.time1) {
clearTimeout(this.time1);
}
// 显示中间层返回按钮
this.showHideMiddleLayerBackBtn(true);
}
......
......@@ -40,12 +40,16 @@ export default class NewClass extends cc.Component {
@property(cc.Node)
endTime: cc.Node = null;
@property(cc.Node)
centerInfo: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
currentTime = null;
winWidth = 0;
hideSetTimeoutId= null;
start () {
this.initdDrag();
this.winWidth = cc.find("/Canvas").width;
......@@ -69,9 +73,20 @@ export default class NewClass extends cc.Component {
this.show()
})
this.node.on("hide", (opt)=>{
this.hide()
// this.node.on("hide", (opt)=>{
// this.hide()
// })
this.node.on("tips", (opt)=>{
const {message, startTime, endTime} = opt
if(message) {
this.showTipInfo(message ? message : "")
} else if(this.checkNumber(startTime) && this.checkNumber(endTime)) {
this.showTipInfo(`${this.formatTimeShow(startTime)} / ${this.formatTimeShow(endTime)}`)
}
})
}
onPlayClick() {
......@@ -91,7 +106,9 @@ export default class NewClass extends cc.Component {
}
onExitFullscreenClick() {
this.node.emit("exit_fullscreen")
this.node.emit("exit_fullscreen");
this.hide()
this.cleanMyTimeout()
}
setProgress(percent, startTime, endTime) {
......@@ -104,24 +121,54 @@ export default class NewClass extends cc.Component {
this.progressCurrent.width = this.progressBg.width * percent;
this.progressDot.x = -this.progressBg.width / 2 + this.progressCurrent.width
if(startTime != undefined && startTime != null) {
this.startTime.getComponent(cc.Label).string = this.formatSeconds(startTime);
this.startTime.getComponent(cc.Label).string = this.formatTimeShow(startTime);
}
if(endTime != undefined && startTime != null) {
this.endTime.getComponent(cc.Label).string = this.formatSeconds(endTime);
this.endTime.getComponent(cc.Label).string = this.formatTimeShow(endTime);
}
}
show(){
this.node.opacity = 255;
this.node.x = 0;
this.cleanMyTimeout()
this.hideSetTimeoutId = setTimeout(() => {
this.hide()
}, 5000);
}
hide(){
this.node.emit("hide");
this.node.opacity = 255;
this.node.x = -this.winWidth;
}
formatSeconds (value) {
centerTipInfoSettimeoutId = null;
showTipInfo(text){
cc.find("/text", this.centerInfo).getComponent(cc.Label).string = text;
this.centerInfo.active = true;
if(this.centerTipInfoSettimeoutId) {
clearTimeout(this.centerTipInfoSettimeoutId)
this.centerTipInfoSettimeoutId = null;
}
this.centerTipInfoSettimeoutId = setTimeout(()=>{
this.centerInfo.active = false;
}, 1000)
}
cleanMyTimeout() {
if(this.hideSetTimeoutId) {
clearTimeout(this.hideSetTimeoutId);
this.hideSetTimeoutId = null;
}
}
checkNumber(val) {
const reg = /^[0-9]+.?[0-9]*/;
return reg.test(val)
}
formatTimeShow (value) {
const checkZero = (value) => {
if(value < 1) {
return 0
......@@ -170,7 +217,7 @@ export default class NewClass extends cc.Component {
this.progressDot.off(cc.Node.EventType.TOUCH_START);
this.progressDot.on(cc.Node.EventType.TOUCH_START, (e) => {
this.draging = true;
this.node.emit("pause")
this.node.emit("pause");
});
this.progressDot.off(cc.Node.EventType.TOUCH_MOVE);
......@@ -184,20 +231,23 @@ export default class NewClass extends cc.Component {
percent = 1;
}
this.node.emit("draging_progress", {percent});
this.centerInfo.active = true;
this.setProgress(percent, null, null);
this.show()
});
this.node.off(cc.Node.EventType.TOUCH_END);
this.node.on(cc.Node.EventType.TOUCH_END, (e) => {
this.draging = false;
this.node.emit("play")
this.centerInfo.active = false;
});
this.node.off(cc.Node.EventType.MOUSE_UP);
this.node.on(cc.Node.EventType.MOUSE_UP, (e) => {
this.draging = false;
this.node.emit("play");
this.centerInfo.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