@shijiu/jsview-vue 0.9.502 → 0.9.590
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/target_core_revision.js +4 -3
- package/index.js +10 -0
- package/package.json +8 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +16 -5
- package/samples/AnimPicture/App.vue +89 -106
- package/samples/Basic/App.vue +65 -68
- package/samples/Basic/components/ContentBlock.vue +31 -36
- package/samples/Basic/components/anim/AnimGroup.vue +61 -75
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +54 -43
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +25 -31
- package/samples/Basic/components/anim/AnimTransition.vue +142 -105
- package/samples/Basic/components/div/DivBackground.vue +38 -16
- package/samples/Basic/components/div/DivClip.vue +143 -78
- package/samples/Basic/components/div/DivCssScoped.vue +10 -10
- package/samples/Basic/components/div/DivCssVar.vue +40 -42
- package/samples/Basic/components/div/DivGroup1.vue +45 -39
- package/samples/Basic/components/div/DivGroup2.vue +56 -45
- package/samples/Basic/components/div/DivLayout.vue +34 -5
- package/samples/Basic/components/div/DivRadius.vue +51 -42
- package/samples/Basic/components/div/DivTransform.vue +21 -16
- package/samples/Basic/components/panel/Panel1.vue +46 -44
- package/samples/Basic/components/panel/Panel2.vue +22 -26
- package/samples/Basic/components/panel/TitleBar.vue +12 -12
- package/samples/Basic/components/text/TextAlign.vue +54 -44
- package/samples/Basic/components/text/TextEmoji.vue +16 -20
- package/samples/Basic/components/text/TextFontStyle.vue +77 -53
- package/samples/Basic/components/text/TextGroup1.vue +46 -38
- package/samples/Basic/components/text/TextGroup2.vue +25 -28
- package/samples/Basic/components/text/TextOverflow.vue +76 -57
- package/samples/BasicFocusControl/App.vue +22 -43
- package/samples/BasicFocusControl/components/BaseBlock.vue +42 -43
- package/samples/BasicFocusControl/components/MainArea.vue +55 -70
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +11 -15
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +21 -24
- package/samples/BasicFocusControl/components/SideBar.vue +32 -47
- package/samples/BasicFocusControl/components/SideBarBlock.vue +20 -23
- package/samples/ColorSpace/App.vue +15 -24
- package/samples/DemoHomepage/App.vue +7 -11
- package/samples/DemoHomepage/components/BodyFrame.vue +19 -9
- package/samples/DemoHomepage/components/TabFrame.vue +7 -8
- package/samples/DemoHomepage/router.js +32 -33
- package/samples/DemoHomepage/views/Homepage.vue +24 -8
- package/samples/FilterDemo/AnimatePic.vue +58 -0
- package/samples/FilterDemo/App.vue +99 -61
- package/samples/FilterDemo/VideoLayer.vue +62 -0
- package/samples/FlipCard/App.vue +32 -41
- package/samples/FlipCard/FlipCard.vue +48 -54
- package/samples/GridDemo/App.vue +109 -77
- package/samples/GridDemo/ButtonBlock.vue +50 -49
- package/samples/GridDemo/FocusItem.vue +19 -38
- package/samples/GridDemo/Item.vue +46 -54
- package/samples/HashHistory/App.vue +63 -79
- package/samples/HashHistory/components/HorizontalButtonList.vue +72 -95
- package/samples/HashHistory/components/Item.vue +42 -56
- package/samples/HashHistory/router.js +23 -12
- package/samples/HashHistory/views/MainPage.vue +35 -46
- package/samples/HashHistory/views/SubPage.vue +34 -47
- package/samples/Input/App.vue +2 -3
- package/samples/Input/FullKeyboard.vue +2 -6
- package/samples/Input/InputPanel.vue +2 -3
- package/samples/Input/KeyboardItem.vue +1 -1
- package/samples/LongImage/App.vue +11 -27
- package/samples/LongImage/Button.vue +50 -145
- package/samples/LongImage/ButtonItem.vue +44 -0
- package/samples/LongImage/LongImageScroll.vue +71 -106
- package/samples/LongImage/Scroll.vue +7 -9
- package/samples/LongText/App.vue +13 -28
- package/samples/LongText/Button.vue +43 -145
- package/samples/LongText/ButtonItem.vue +44 -0
- package/samples/LongText/LongTextScroll.vue +68 -101
- package/samples/LongText/Scroll.vue +7 -9
- package/samples/Marquee/App.vue +34 -37
- package/samples/MaskClip/App.vue +17 -30
- package/samples/MetroWidgetDemos/Advanced/App.vue +211 -0
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
- package/samples/MetroWidgetDemos/Item.vue +67 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/App.vue +80 -104
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/Item.vue +7 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/bg.jpg +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_content.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_left.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_mid.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_right.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/focus_border.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/holder_logo.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/jrbm.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_left.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_mid.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_right.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/loading.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/logo.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/mcjx.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tao.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tmall.png +0 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/border.png +0 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/ContentItem.vue +60 -86
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/MyTab.vue +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/data.js +45 -0
- package/samples/MetroWidgetDemos/PingPong/App.vue +135 -0
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +58 -0
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +69 -0
- package/samples/MetroWidgetDemos/PingPong/Item.vue +92 -0
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/samples/MetroWidgetDemos/Simple/App.vue +194 -0
- package/samples/MetroWidgetDemos/WidgetItem.vue +89 -0
- package/samples/MetroWidgetDemos/data.js +204 -0
- package/samples/NinePatchDemo/App.vue +114 -115
- package/samples/NinePatchDemo/Item.vue +7 -8
- package/samples/Preload/App.vue +61 -63
- package/samples/Preload/Item.vue +21 -29
- package/samples/QrcodeDemo/App.vue +24 -29
- package/samples/SoundPool/App.vue +77 -106
- package/samples/SprayView/App.vue +10 -8
- package/samples/SpriteImage/App.vue +1 -2
- package/samples/TextBox/App.vue +86 -101
- package/samples/TextBox/RenderCenter.vue +1 -1
- package/samples/TextBox/RenderLeft.vue +1 -1
- package/samples/TextBox/RenderOneLine.vue +1 -1
- package/samples/TextBox/RenderRight.vue +1 -1
- package/samples/TextShadowDemo/App.vue +1 -2
- package/samples/TextureAnimation/App.vue +16 -13
- package/samples/TextureSize/App.vue +15 -25
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +2 -4
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +2 -3
- package/samples/ThrowMoveDemo/TargetDemo.vue +3 -4
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +2 -3
- package/samples/TouchSample/App.vue +2 -3
- package/samples/TouchSample/Item.vue +15 -13
- package/samples/TouchSample/MetroWidgetHorizontal.vue +2 -2
- package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
- package/samples/TouchSample/TouchContainerHorizontal.vue +4 -3
- package/samples/TouchSample/TouchContainerVertical.vue +3 -2
- package/samples/TransitPage/App.vue +20 -32
- package/samples/VideoDemo/App.vue +65 -81
- package/samples/VideoDemo/components/Button.vue +41 -52
- package/samples/VideoDemo/components/Controllor.vue +171 -169
- package/samples/VideoDemo/components/VideoFrame.vue +87 -99
- package/samples/VisibleSensorDemo/App.vue +167 -0
- package/scripts/jsview-jsmap-serve.js +42 -0
- package/scripts/jsview-post-install.js +1 -1
- package/tsconfig.json +3 -0
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +204 -193
- package/utils/JsViewEngineWidget/JsvFocusManager.js +30 -17
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +1555 -1656
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +136 -0
- package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +18 -0
- package/utils/JsViewEngineWidget/TemplateParser.js +111 -1
- package/utils/JsViewEngineWidget/WidgetCommon.js +8 -2
- package/utils/JsViewEngineWidget/index.js +4 -4
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +264 -54
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +5 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvRefTaker.js +35 -0
- package/utils/JsViewVueTools/index.js +19 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +8 -4
- package/utils/JsViewVueWidget/JsvFilterView.vue +59 -51
- package/utils/JsViewVueWidget/JsvGrid.vue +139 -41
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +3 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +8 -17
- package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -1
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +37 -7
- package/utils/JsViewVueWidget/JsvPosterImage.vue +34 -13
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +2 -12
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +13 -10
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -3
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +25 -21
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +7 -8
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +141 -0
- package/utils/JsViewVueWidget/JsvVisibleSensor/index.js +9 -0
- package/utils/JsViewVueWidget/index.js +42 -0
- package/samples/AdvanceMetroWidget/App.vue +0 -123
- package/samples/AdvanceMetroWidget/Frame.vue +0 -102
- package/samples/AdvanceMetroWidget/Item.vue +0 -63
- package/samples/AdvanceMetroWidget/data.js +0 -137
- package/samples/ClassNameDemo/App.vue +0 -119
- package/samples/ClassNameDemo/components/ContentItem.vue +0 -253
- package/samples/ClassNameDemo/components/LoadingView.vue +0 -43
- package/samples/ClassNameDemo/components/TitleView.vue +0 -24
- package/samples/ClassNameDemo/data.js +0 -24
- package/samples/FlowMultiWidget/App.vue +0 -91
- package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
- package/samples/FlowMultiWidget/components/Block.vue +0 -107
- package/samples/FlowMultiWidget/components/FlowPage.vue +0 -60
- package/samples/FlowMultiWidget/components/Item.vue +0 -103
- package/samples/FlowMultiWidget/components/MenuItem.vue +0 -72
- package/samples/FlowMultiWidget/components/MyMenu.vue +0 -90
- package/samples/FlowMultiWidget/data.js +0 -446
- package/samples/HashHistory/views/BasePage.vue +0 -19
- package/samples/HashHistory/views/SubPageFirst.vue +0 -10
- package/samples/HashHistory/views/SubPageSecond.vue +0 -10
- package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
- package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
- package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
- package/samples/SimpleWidgetDemo/data.js +0 -124
- package/utils/JsViewEngineWidget/MetroWidget/ContentView.vue +0 -63
- package/utils/JsViewEngineWidget/MetroWidget/DivWrapper.vue +0 -51
- package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +0 -213
- package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +0 -154
|
@@ -1,194 +1,196 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { inject } from
|
|
3
|
-
import {
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject } from "vue";
|
|
3
|
+
import { useRouter } from "vue-router";
|
|
4
4
|
import Button from "./Button.vue";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
style: {
|
|
8
|
+
type: Object,
|
|
9
|
+
default() {
|
|
10
|
+
return { width: 1400, height: 50 };
|
|
11
|
+
},
|
|
9
12
|
},
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
});
|
|
14
|
+
const router = useRouter();
|
|
15
|
+
|
|
16
|
+
const useTexture = inject("useTexture");
|
|
17
|
+
const objectFit = inject("objectFit");
|
|
18
|
+
const videoRect = inject("videoRect");
|
|
19
|
+
const playVideo = inject("playVideo");
|
|
20
|
+
const seekVideo = inject("seekVideo");
|
|
21
|
+
const enableAnimation = inject("enableAnimation");
|
|
22
|
+
const videoTime = inject("videoTime");
|
|
23
|
+
const objectFitTitle = inject("objectFitTitle");
|
|
24
|
+
let objectFitIndex = 0;
|
|
25
|
+
let focusedItemIndex = 0;
|
|
26
|
+
|
|
27
|
+
const setObjectFit = (index) => {
|
|
28
|
+
if (typeof index === "number") {
|
|
29
|
+
objectFitIndex = index;
|
|
30
|
+
} else {
|
|
31
|
+
objectFitIndex = ++objectFitIndex % objectFitData.length;
|
|
32
|
+
}
|
|
33
|
+
const data = objectFitData[objectFitIndex];
|
|
34
|
+
objectFit.value = data.objectFit;
|
|
35
|
+
objectFitTitle.value = data.name;
|
|
36
|
+
videoRect.value = {
|
|
37
|
+
left: (1280 - data.width) / 2,
|
|
38
|
+
top: 50,
|
|
39
|
+
width: data.width,
|
|
40
|
+
height: 500,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const buttonList = [
|
|
45
|
+
{
|
|
46
|
+
name: "ToVideoMode",
|
|
47
|
+
onClick: () => {
|
|
48
|
+
playVideo.value = null; // 停止并初始化播放
|
|
49
|
+
enableAnimation.value = false;
|
|
50
|
+
videoTime.currentTime = 0;
|
|
51
|
+
videoTime.duration = 0;
|
|
52
|
+
useTexture.value = !useTexture.value;
|
|
53
|
+
},
|
|
54
|
+
isModeButton: true,
|
|
12
55
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
56
|
+
{
|
|
57
|
+
name: "Play",
|
|
58
|
+
onClick: () => {
|
|
59
|
+
playVideo.value = !playVideo.value;
|
|
60
|
+
},
|
|
61
|
+
isPlayButton: true,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "Forward",
|
|
65
|
+
onClick: () => {
|
|
66
|
+
seekVideo.value = seekVideo.value !== 5 ? 5 : 5.1 /* 为了触发ref更新 */;
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "Rewind",
|
|
71
|
+
onClick: () => {
|
|
72
|
+
seekVideo.value =
|
|
73
|
+
seekVideo.value !== -5 ? -5 : -5.1 /* 为了触发ref更新 */;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "ObjectFit",
|
|
78
|
+
onClick: setObjectFit,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "StartAnimation",
|
|
82
|
+
onClick: () => {
|
|
83
|
+
enableAnimation.value = !enableAnimation.value;
|
|
84
|
+
},
|
|
85
|
+
isAnimationButton: true,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
const objectFitData = [
|
|
89
|
+
{ name: "contain-horizontal", objectFit: "contain", width: 1200 },
|
|
90
|
+
{ name: "contain-vertical", objectFit: "contain", width: 400 },
|
|
91
|
+
{ name: "fill", objectFit: "fill", width: 1200 },
|
|
92
|
+
{ name: "none-horizontal", objectFit: "none", width: 1200 },
|
|
93
|
+
{ name: "none-vertical", objectFit: "none", width: 400 },
|
|
94
|
+
{ name: "cover-horizontal", objectFit: "cover", width: 1200 },
|
|
95
|
+
{ name: "cover-vertical", objectFit: "cover", width: 400 },
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const getButtonData = () => {
|
|
99
|
+
let length = buttonList.length;
|
|
100
|
+
if (!useTexture.value) {
|
|
101
|
+
// 只有texture方式可以做animation
|
|
102
|
+
length -= 1;
|
|
41
103
|
}
|
|
42
104
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
105
|
+
let data = [];
|
|
106
|
+
for (let idx = 0; idx < length; idx++) {
|
|
107
|
+
const button = buttonList[idx];
|
|
108
|
+
data.push({
|
|
109
|
+
...button,
|
|
110
|
+
size: {
|
|
111
|
+
width: 180,
|
|
112
|
+
height: 40,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
48
115
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
let changeFocusTo = -1;
|
|
58
|
-
const buttonCount = this.getButtonDataLength();
|
|
59
|
-
switch (ev.keyCode) {
|
|
60
|
-
case 37: // Left
|
|
61
|
-
changeFocusTo = (this.focusedItemIndex - 1 + buttonCount) % buttonCount;
|
|
62
|
-
break;
|
|
63
|
-
case 39: // Right
|
|
64
|
-
changeFocusTo = (this.focusedItemIndex + 1) % buttonCount;
|
|
65
|
-
break;
|
|
66
|
-
default:
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
if (changeFocusTo >= 0) {
|
|
70
|
-
ev.ownerNode.findBlockByName((changeFocusTo+10).toString()).requestFocus();
|
|
71
|
-
this.focusedItemIndex = changeFocusTo;
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return false;
|
|
116
|
+
return data;
|
|
117
|
+
};
|
|
118
|
+
const getButtonDataLength = () => {
|
|
119
|
+
let length = buttonList.length;
|
|
120
|
+
if (!useTexture.value) {
|
|
121
|
+
// 只有texture方式可以做animation
|
|
122
|
+
length -= 1;
|
|
76
123
|
}
|
|
77
124
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.videoTime.duration = 0;
|
|
86
|
-
this.useTexture = !this.useTexture;
|
|
87
|
-
},
|
|
88
|
-
isModeButton: true,
|
|
89
|
-
}, {
|
|
90
|
-
name: "Play",
|
|
91
|
-
onClick: () => {
|
|
92
|
-
this.playVideo = !this.playVideo;
|
|
93
|
-
},
|
|
94
|
-
isPlayButton: true,
|
|
95
|
-
}, {
|
|
96
|
-
name: "Forward",
|
|
97
|
-
onClick: () => {
|
|
98
|
-
this.seekVideo = (this.seekVideo !== 5 ? 5 : 5.1/* 为了触发ref更新 */);
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
name: "Rewind",
|
|
102
|
-
onClick: () => {
|
|
103
|
-
this.seekVideo = (this.seekVideo !== -5 ? -5 : -5.1/* 为了触发ref更新 */);
|
|
104
|
-
}
|
|
105
|
-
}, {
|
|
106
|
-
name: "ObjectFit",
|
|
107
|
-
onClick: this.setObjectFit.bind(this)
|
|
108
|
-
}, {
|
|
109
|
-
name: "StartAnimation",
|
|
110
|
-
onClick: () => {
|
|
111
|
-
this.enableAnimation = !this.enableAnimation
|
|
112
|
-
},
|
|
113
|
-
isAnimationButton: true,
|
|
114
|
-
},
|
|
115
|
-
];
|
|
116
|
-
|
|
117
|
-
return buttonList;
|
|
125
|
+
return length;
|
|
126
|
+
};
|
|
127
|
+
const onKeyDown = (ev) => {
|
|
128
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
129
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
130
|
+
router?.go(-1); // 有router时,回退
|
|
131
|
+
return true;
|
|
118
132
|
}
|
|
119
133
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
size: {
|
|
132
|
-
width: 180,
|
|
133
|
-
height: 40,
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return data;
|
|
134
|
+
let changeFocusTo = -1;
|
|
135
|
+
const buttonCount = getButtonDataLength();
|
|
136
|
+
switch (ev.keyCode) {
|
|
137
|
+
case 37: // Left
|
|
138
|
+
changeFocusTo = (focusedItemIndex - 1 + buttonCount) % buttonCount;
|
|
139
|
+
break;
|
|
140
|
+
case 39: // Right
|
|
141
|
+
changeFocusTo = (focusedItemIndex + 1) % buttonCount;
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
break;
|
|
138
145
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return length;
|
|
146
|
+
if (changeFocusTo >= 0) {
|
|
147
|
+
ev.ownerNode
|
|
148
|
+
.findBlockByName("video-" + (changeFocusTo + 10).toString())
|
|
149
|
+
.requestFocus();
|
|
150
|
+
focusedItemIndex = changeFocusTo;
|
|
151
|
+
return true;
|
|
147
152
|
}
|
|
148
153
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.objectFitIndex = index;
|
|
152
|
-
} else {
|
|
153
|
-
this.objectFitIndex = (++this.objectFitIndex % this.objectFitData.length);
|
|
154
|
-
}
|
|
155
|
-
const data = this.objectFitData[this.objectFitIndex];
|
|
156
|
-
this.objectFit = data.objectFit;
|
|
157
|
-
this.objectFitTitle = data.name;
|
|
158
|
-
this.videoRect = {
|
|
159
|
-
left: (1280 - data.width) / 2, top: 50,
|
|
160
|
-
width: data.width, height: 500,
|
|
161
|
-
}
|
|
162
|
-
}
|
|
154
|
+
return false;
|
|
155
|
+
};
|
|
163
156
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
return item.name;
|
|
157
|
+
const getShowName = (item) => {
|
|
158
|
+
if (item.isModeButton) {
|
|
159
|
+
return useTexture.value ? "ToVideoMode" : "ToOffscreenMode";
|
|
160
|
+
} else if (item.isPlayButton) {
|
|
161
|
+
return playVideo.value ? "Pause" : "Play";
|
|
162
|
+
} else if (item.isAnimationButton) {
|
|
163
|
+
return enableAnimation.value ? "StopAnimation" : "StartAnimation";
|
|
173
164
|
}
|
|
174
|
-
|
|
165
|
+
return item.name;
|
|
166
|
+
};
|
|
175
167
|
|
|
176
|
-
|
|
168
|
+
useTexture.value = false;
|
|
169
|
+
setObjectFit(0);
|
|
170
|
+
playVideo.value = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整;
|
|
171
|
+
enableAnimation.value = false;
|
|
177
172
|
</script>
|
|
178
173
|
|
|
179
174
|
<template>
|
|
180
|
-
<div :style="style" :key="useTexture" :set="leftOffset=0">
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
<div :style="style" :key="useTexture" :set="(leftOffset = 0)">
|
|
176
|
+
<jsv-focus-block :namespace="controllor" :onKeyDown="onKeyDown">
|
|
177
|
+
<Button
|
|
178
|
+
v-for="(item, index) in getButtonData()"
|
|
179
|
+
:key="index"
|
|
180
|
+
:set="(leftOffset += item.size.width + 10)"
|
|
181
|
+
:style="{
|
|
182
|
+
left: leftOffset - item.size.width,
|
|
183
|
+
width: item.size.width,
|
|
184
|
+
height: item.size.height,
|
|
185
|
+
}"
|
|
184
186
|
:autoFocus="index === 0"
|
|
185
|
-
:name="(index+10).toString()"
|
|
187
|
+
:name="'video-' + (index + 10).toString()"
|
|
186
188
|
:onClick="item.onClick"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
</div>
|
|
189
|
+
>
|
|
190
|
+
{{ getShowName(item) }}
|
|
191
|
+
</Button>
|
|
192
|
+
</jsv-focus-block>
|
|
193
|
+
</div>
|
|
192
194
|
</template>
|
|
193
195
|
|
|
194
196
|
<style scoped>
|
|
@@ -1,121 +1,109 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { inject, watch } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, watch, onMounted } from "vue";
|
|
3
|
+
import { JsvVideo } from "jsview";
|
|
4
|
+
|
|
5
|
+
const useTexture = inject("useTexture");
|
|
6
|
+
const objectFit = inject("objectFit");
|
|
7
|
+
const videoRect = inject("videoRect");
|
|
8
|
+
const playVideo = inject("playVideo");
|
|
9
|
+
const seekVideo = inject("seekVideo");
|
|
10
|
+
const enableAnimation = inject("enableAnimation");
|
|
11
|
+
const videoTime = inject("videoTime");
|
|
12
|
+
const playStatus = inject("playStatus");
|
|
13
|
+
const videoUrl =
|
|
14
|
+
"http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20190726/4cc4e6a8fd7d9d9c707ed4c4da27ca9d.mp4";
|
|
15
|
+
const canAutoPlay = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整
|
|
16
|
+
const rect = {
|
|
17
|
+
top: 50,
|
|
18
|
+
left: 40,
|
|
19
|
+
width: 1200,
|
|
20
|
+
height: 500,
|
|
21
|
+
};
|
|
22
|
+
let video = null;
|
|
23
|
+
|
|
24
|
+
const onVideoRef = (ele) => {
|
|
25
|
+
video = ele;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const setPlayState = (play) => {
|
|
29
|
+
if (play) {
|
|
30
|
+
video?.play();
|
|
31
|
+
} else {
|
|
32
|
+
video?.pause();
|
|
9
33
|
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
watch(this.seekVideo, this.seekVideoStep.bind(this));
|
|
25
|
-
|
|
26
|
-
this.videoUrl = "http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20190726/4cc4e6a8fd7d9d9c707ed4c4da27ca9d.mp4";
|
|
27
|
-
this.canAutoPlay = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整
|
|
28
|
-
|
|
29
|
-
this.video = null;
|
|
30
|
-
|
|
31
|
-
this.rect = {
|
|
32
|
-
top: 50, left: 40,
|
|
33
|
-
width: 1200, height: 500,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const seekVideoStep = (time) => {
|
|
37
|
+
if (video) {
|
|
38
|
+
let playEnd = false;
|
|
39
|
+
let seekTime = video.currentTime + Math.ceil(time);
|
|
40
|
+
if (seekTime < 0) {
|
|
41
|
+
seekTime = 0;
|
|
42
|
+
} else if (seekTime > videoTime.duration) {
|
|
43
|
+
seekTime = videoTime.duration;
|
|
44
|
+
if (video.currentTime != videoTime.duration) {
|
|
45
|
+
// 触发一次播放,收到ended事件
|
|
46
|
+
playEnd = true;
|
|
47
|
+
}
|
|
34
48
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
mounted() {
|
|
40
|
-
if(this.canAutoPlay) {
|
|
41
|
-
this.playVideo = true;
|
|
49
|
+
video.currentTime = seekTime;
|
|
50
|
+
if (playEnd) {
|
|
51
|
+
this.setPlayState(true);
|
|
42
52
|
}
|
|
43
53
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const onPlayStateChange = (event) => {
|
|
57
|
+
console.log("VideoFrame.onPlayStateChangeEvent()", event);
|
|
58
|
+
playVideo.value = event.type === "play" ? true : false;
|
|
59
|
+
if (!(playStatus.value == "ended" && event.type == "pause")) {
|
|
60
|
+
// 忽略播放结束后的pause事件
|
|
61
|
+
playStatus.value = event.type;
|
|
47
62
|
}
|
|
63
|
+
};
|
|
48
64
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.video?.pause();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
65
|
+
const onTimeUpdate = (event) => {
|
|
66
|
+
console.log("VideoFrame.onTimeUpdateEvent()", event);
|
|
67
|
+
videoTime.currentTime = video.currentTime;
|
|
68
|
+
};
|
|
56
69
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if(seekTime < 0) {
|
|
62
|
-
seekTime = 0;
|
|
63
|
-
} else if(seekTime > this.videoTime.duration) {
|
|
64
|
-
seekTime = this.videoTime.duration;
|
|
65
|
-
if(this.video.currentTime != this.videoTime.duration) { // 触发一次播放,收到ended事件
|
|
66
|
-
playEnd = true;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
this.video.currentTime = seekTime;
|
|
70
|
-
if(playEnd) {
|
|
71
|
-
this.setPlayState(true);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
70
|
+
const onDurationChange = (event) => {
|
|
71
|
+
console.log("VideoFrame.onDurationChangeEvent()", event);
|
|
72
|
+
videoTime.duration = video.duration;
|
|
73
|
+
};
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if(!(this.playStatus == 'ended' && event.type == 'pause')) { // 忽略播放结束后的pause事件
|
|
80
|
-
this.playStatus = event.type;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
75
|
+
const onEvent = (event) => {
|
|
76
|
+
console.log("VideoFrame.onEvent()", event);
|
|
77
|
+
};
|
|
83
78
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.videoTime.currentTime = this.video.currentTime;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
onDurationChange(event) {
|
|
90
|
-
console.log("VideoFrame.onDurationChangeEvent()", event);
|
|
91
|
-
this.videoTime.duration = this.video.duration;
|
|
92
|
-
}
|
|
79
|
+
watch(playVideo, setPlayState);
|
|
80
|
+
watch(seekVideo, seekVideoStep);
|
|
93
81
|
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
onMounted(() => {
|
|
83
|
+
if (canAutoPlay) {
|
|
84
|
+
playVideo.value = true;
|
|
96
85
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export default VideoFrame;
|
|
86
|
+
});
|
|
100
87
|
</script>
|
|
101
88
|
|
|
102
89
|
<template>
|
|
103
|
-
<div>
|
|
104
|
-
|
|
90
|
+
<div>
|
|
91
|
+
<div
|
|
105
92
|
:style="{
|
|
106
93
|
...videoRect,
|
|
107
|
-
backgroundColor: 'rgb(200,100,100)'
|
|
94
|
+
backgroundColor: 'rgb(200,100,100)',
|
|
108
95
|
}"
|
|
109
|
-
|
|
110
|
-
|
|
96
|
+
></div>
|
|
97
|
+
<JsvVideo
|
|
111
98
|
:onRef="onVideoRef"
|
|
112
99
|
:useTexture="useTexture"
|
|
113
100
|
:src="videoUrl"
|
|
114
|
-
:autoplay="canAutoPlay ? 'autoplay' : undefined"
|
|
101
|
+
:autoplay="canAutoPlay ? 'autoplay' : undefined"
|
|
115
102
|
:style="{
|
|
116
103
|
...videoRect,
|
|
117
104
|
objectFit: objectFit,
|
|
118
|
-
animation:
|
|
105
|
+
animation:
|
|
106
|
+
useTexture && enableAnimation ? 'offscreenAnim 3s infinite' : null,
|
|
119
107
|
borderRadius: '80px 80px 160px 240px',
|
|
120
108
|
}"
|
|
121
109
|
:onCanPlay="onEvent"
|
|
@@ -134,18 +122,18 @@ export default VideoFrame;
|
|
|
134
122
|
:onSeeked="onTimeUpdate"
|
|
135
123
|
:onStalled="onEvent"
|
|
136
124
|
:onTimeUpdate="onTimeUpdate"
|
|
137
|
-
|
|
138
|
-
</div>
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
139
127
|
</template>
|
|
140
128
|
|
|
141
129
|
<style scoped>
|
|
142
130
|
@keyframes offscreenAnim {
|
|
143
131
|
from {
|
|
144
|
-
transform:scale3d(1, 1, 1) rotate3d(0, 0, 1, -360deg);
|
|
132
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, -360deg);
|
|
145
133
|
transform-origin: center center;
|
|
146
134
|
}
|
|
147
135
|
to {
|
|
148
|
-
transform:scale3d(0.4, 0.4, 0) rotate3d(0, 0, 1, 0);
|
|
136
|
+
transform: scale3d(0.4, 0.4, 0) rotate3d(0, 0, 1, 0);
|
|
149
137
|
transform-origin: center center;
|
|
150
138
|
}
|
|
151
139
|
}
|