@shijiu/jsview-vue-samples 2.3.151-test.0 → 3.0.0-test.0

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.
Files changed (228) hide show
  1. package/ABImageAlt/App.vue +114 -0
  2. package/ABImageAlt/Item.vue +133 -0
  3. package/{MetroWidgetDemos/SkeletonDiagram/assets/imageList.json → ABImageAlt/assets/imageList.js} +9 -1
  4. package/ABImageAlt/data.js +17 -0
  5. package/AI_Check_Rules.txt +5 -0
  6. package/AnimPicture/App.vue +20 -10
  7. package/ApicSwitch/App.vue +90 -0
  8. package/ApicSwitch/TabItem.vue +65 -0
  9. package/ApicSwitch/WebpShow.vue +24 -0
  10. package/ApicSwitch/data.js +50 -0
  11. package/Basic/AI_skills_update.md +1 -0
  12. package/Basic/components/div/ColorFormatTest.vue +93 -0
  13. package/Basic/components/div/DivRadius.vue +97 -15
  14. package/Basic/components/div/DivTag3Group.vue +30 -0
  15. package/Basic/components/img/ImageType.vue +65 -0
  16. package/Basic/components/panel/Panel2.vue +13 -1
  17. package/Basic/components/text/TextAlign.vue +7 -1
  18. package/BlobLoadTest/App.vue +201 -0
  19. package/BreakLinesApi/App.vue +82 -0
  20. package/CanvasDrawChart/App.vue +11 -0
  21. package/CanvasDrawChart/Graph1.vue +104 -0
  22. package/CanvasDrawChart/Graph2.vue +115 -0
  23. package/CssPreprocessor/Scss/PanelData.js +1 -1
  24. package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +4 -3
  25. package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +2 -2
  26. package/DemoForOperator/Bounce/FreeMoveBuilder.js +1 -1
  27. package/DemoForOperator/Firework1/App.vue +12 -1
  28. package/DemoForOperator/Firework1/Fireworks.vue +18 -0
  29. package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +1 -0
  30. package/DemoForOperator/Focus/Alpha/Item.vue +1 -0
  31. package/DemoForOperator/Focus/Light/Item.vue +1 -0
  32. package/DemoForOperator/Focus/Normal/Item.vue +1 -0
  33. package/DemoForOperator/FrameShadow/FrameShadow.vue +1 -1
  34. package/DemoForOperator/Genie/App.vue +20 -6
  35. package/DemoForOperator/Genie/App2.vue +61 -0
  36. package/DemoForOperator/Genie/geniePakcer/GenieImage.vue +298 -0
  37. package/DemoForOperator/Genie/geniePakcer/GenieSlot.vue +292 -0
  38. package/DemoForOperator/Genie/geniePakcer/GenieTools.ts +463 -0
  39. package/DemoForOperator/Jigsaw/JigsawFull.vue +12 -7
  40. package/DemoForOperator/Jigsaw/JigsawSingle.vue +13 -7
  41. package/DemoForOperator/LongChatBox/App.vue +13 -13
  42. package/DemoForOperator/LongChatBox/Bubble.vue +78 -66
  43. package/DemoForOperator/LongChatBox/LongChat.vue +68 -36
  44. package/DemoForOperator/LongChatBox/testData.js +7 -44
  45. package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +1 -1
  46. package/DemoForOperator/routeList.js +8 -2
  47. package/DemoHomepage/App.vue +74 -1
  48. package/DemoHomepage/components/BodyFrame.vue +1 -0
  49. package/DemoHomepage/components/TabFrame.vue +1 -1
  50. package/DemoHomepage/router.js +723 -160
  51. package/DemoHomepage/views/Homepage.vue +60 -2
  52. package/DemoHomepage/watchTest.vue +50 -0
  53. package/FilterDemo/AnimatePic.vue +63 -17
  54. package/FilterDemo/App.vue +3 -3
  55. package/FlexCellDemo/AI_skills_update.md +4 -0
  56. package/FlexCellDemo/TestFrame1.vue +12 -2
  57. package/FlexCellDemo/TestFrame2.vue +10 -1
  58. package/FlexCellDemo/TestFrame3.vue +114 -59
  59. package/FpsLimit/App.vue +102 -0
  60. package/FreeMoveChildAttract/App.vue +18 -8
  61. package/FreeMoveLink/App.vue +49 -20
  62. package/Hover/App.vue +144 -0
  63. package/HttpRequestSSE/SSEReader.js +200 -0
  64. package/ImpactStop/App.vue +2 -2
  65. package/Input/FullKeyboard.vue +3 -3
  66. package/Input/InputPanel.vue +63 -3
  67. package/JsvLine/App.vue +53 -38
  68. package/LatexDemo/App.vue +3 -1
  69. package/LatexFormula/App.vue +196 -0
  70. package/LongImage/App.vue +1 -1
  71. package/LongImage/LongImageScroll.vue +100 -47
  72. package/LongImage/Scroll.vue +28 -9
  73. package/LongText/LongTextScroll.vue +1 -0
  74. package/Markdown/App.vue +36 -0
  75. package/Markdown/Bubble.vue +109 -0
  76. package/Markdown/LongChat.vue +206 -0
  77. package/Markdown/Markdown/Markdown.vue +156 -0
  78. package/Markdown/Markdown/index.ts +1 -0
  79. package/Markdown/Markdown/marked/LICENSE.md +45 -0
  80. package/Markdown/Markdown/marked/index.ts +2 -0
  81. package/Markdown/Markdown/marked/marked.d.ts +756 -0
  82. package/Markdown/Markdown/marked/marked.js +71 -0
  83. package/Markdown/Markdown/parser.ts +1365 -0
  84. package/Markdown/data.js +581 -0
  85. package/MetroWidgetDemos/AI_skills_update.md +2 -0
  86. package/MetroWidgetDemos/ListExpand/ChildItem.vue +130 -0
  87. package/MetroWidgetDemos/ListExpand/ExpandItem.vue +375 -0
  88. package/MetroWidgetDemos/ListExpand/ExpandItem1.vue +403 -0
  89. package/MetroWidgetDemos/ListExpand/assets/arrow-down.png +0 -0
  90. package/MetroWidgetDemos/ListExpand/assets/up-arrow.png +0 -0
  91. package/MetroWidgetDemos/ListExpand/components/WidgetListHandler.vue +150 -0
  92. package/MetroWidgetDemos/ListExpand/index.vue +88 -0
  93. package/MetroWidgetDemos/ListExpand/list.js +2421 -0
  94. package/MetroWidgetDemos/RefreshDemo/App.vue +14 -1
  95. package/MetroWidgetDemos/RenderAccelerate/App.vue +142 -0
  96. package/MetroWidgetDemos/RenderAccelerate/AppPage.vue +78 -0
  97. package/MetroWidgetDemos/RenderAccelerate/AppTab.vue +62 -0
  98. package/MetroWidgetDemos/RenderAccelerate/ContentItem.vue +409 -0
  99. package/MetroWidgetDemos/RenderAccelerate/Item.vue +67 -0
  100. package/MetroWidgetDemos/RenderAccelerate/TabItem.vue +100 -0
  101. package/MetroWidgetDemos/RenderAccelerate/ViewSwiper.vue +215 -0
  102. package/MetroWidgetDemos/RenderAccelerate/WidgetItem.vue +107 -0
  103. package/MetroWidgetDemos/SkeletonDiagram/App.vue +35 -8
  104. package/MetroWidgetDemos/SkeletonDiagram/Item.vue +11 -2
  105. package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.js +245 -0
  106. package/MetroWidgetDemos/SkeletonDiagram/data.js +3 -3
  107. package/MetroWidgetDemos/SpatialNav/App.vue +177 -0
  108. package/MetroWidgetDemos/SpatialNav/Buttons.vue +83 -0
  109. package/MetroWidgetDemos/SpatialNav/CustomFocus.vue +57 -0
  110. package/MetroWidgetDemos/{TripleWidget → SpatialNav}/Item.vue +1 -8
  111. package/MetroWidgetDemos/{TripleWidget/WidgetItem.vue → SpatialNav/SimpleFloor.vue} +14 -45
  112. package/MetroWidgetDemos/SpatialNav/StepMw.vue +113 -0
  113. package/MetroWidgetDemos/SpatialNav/TabContent/TabContent.vue +185 -0
  114. package/MetroWidgetDemos/SpatialNav/TripleSection/TripleSection.vue +69 -0
  115. package/MetroWidgetDemos/SpatialNav/TripleSection/WidgetItem.vue +100 -0
  116. package/MetroWidgetDemos/SpatialNav/TvSection/List.vue +75 -0
  117. package/MetroWidgetDemos/SpatialNav/TvSection/TvSection.vue +91 -0
  118. package/MetroWidgetDemos/basic2/App.vue +407 -0
  119. package/MetroWidgetDemos/basic2/Item.vue +68 -0
  120. package/MetroWidgetDemos/direction/App.vue +22 -0
  121. package/MetroWidgetDemos/gazeFocusDiff/App.vue +126 -0
  122. package/MetroWidgetDemos/gazeFocusDiff/Item.vue +87 -0
  123. package/MetroWidgetDemos/minimalUsage/App.vue +66 -0
  124. package/MetroWidgetDemos/minimalUsage/Item.vue +54 -0
  125. package/MetroWidgetDemos/ninePatchFocusPage/App.vue +22 -7
  126. package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +7 -5
  127. package/MetroWidgetDemos/ninePatchFocusPage/focusConstants.js +2 -0
  128. package/MetroWidgetDemos/routeList.js +203 -12
  129. package/MetroWidgetDemos/slideSetting/App.vue +288 -99
  130. package/MetroWidgetDemos/zIndex/App.vue +117 -0
  131. package/MetroWidgetDemos/zIndex/Item.vue +61 -0
  132. package/NinePatchTester/App.vue +24 -31
  133. package/PreDecode/App.vue +140 -0
  134. package/ReactiveTest/App.vue +115 -0
  135. package/ReactiveTest/Item.vue +92 -0
  136. package/ReactiveTest/assets/imageList.js +245 -0
  137. package/ReactiveTest/component/TestSmartDiv.vue +50 -0
  138. package/ReactiveTest/component/TestSmartDivSrcList.vue +74 -0
  139. package/ReactiveTest/component/TestSmartImage.vue +46 -0
  140. package/ReactiveTest/component/TestSmartImageSrcList.vue +90 -0
  141. package/ReactiveTest/component/TestSmartImageStyle.vue +41 -0
  142. package/ReactiveTest/data.js +49 -0
  143. package/ScreenToBlob/App.vue +250 -0
  144. package/SecTorTest/App.vue +9 -3
  145. package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +3 -3
  146. package/SyncDecode/App.vue +137 -0
  147. package/TextSizeLimit/App.vue +211 -0
  148. package/TransitPage/App.vue +2 -0
  149. package/assets/logo.png +0 -0
  150. package/package.json +5 -5
  151. package/DemoForOperator/Genie/geniePakcer/Genie.vue +0 -741
  152. package/DemoForOperator/LongChatBox/TextManager.ts +0 -147
  153. package/DemoForOperator/LongChatBox/VirtualList.vue +0 -298
  154. package/DemoForOperator/LongChatBox/utile.js +0 -331
  155. package/DivMetroPerformance/App.vue +0 -157
  156. package/DivMetroPerformance/Item.vue +0 -58
  157. package/DivMetroPerformance/assets/bg.jpg +0 -0
  158. package/DivMetroPerformance/assets/coupon_content.png +0 -0
  159. package/DivMetroPerformance/assets/coupon_left.png +0 -0
  160. package/DivMetroPerformance/assets/coupon_mid.png +0 -0
  161. package/DivMetroPerformance/assets/coupon_right.png +0 -0
  162. package/DivMetroPerformance/assets/focus_border.png +0 -0
  163. package/DivMetroPerformance/assets/holder_logo.png +0 -0
  164. package/DivMetroPerformance/assets/jrbm.png +0 -0
  165. package/DivMetroPerformance/assets/line_left.png +0 -0
  166. package/DivMetroPerformance/assets/line_mid.png +0 -0
  167. package/DivMetroPerformance/assets/line_right.png +0 -0
  168. package/DivMetroPerformance/assets/loading.png +0 -0
  169. package/DivMetroPerformance/assets/logo.png +0 -0
  170. package/DivMetroPerformance/assets/mcjx.png +0 -0
  171. package/DivMetroPerformance/assets/tao.png +0 -0
  172. package/DivMetroPerformance/assets/tmall.png +0 -0
  173. package/DivMetroPerformance/border.png +0 -0
  174. package/DivMetroPerformance/components/ContentItem.vue +0 -384
  175. package/DivMetroPerformance/components/MyTab.vue +0 -129
  176. package/DivMetroPerformance/data.js +0 -124
  177. package/DivMetroPerformance/utils/GridItem.vue +0 -28
  178. package/DivMetroPerformance/utils/GridPlate.vue +0 -85
  179. package/MediaDemo/App.vue +0 -127
  180. package/MediaDemo/assets/audio-poster.png +0 -0
  181. package/MediaDemo/components/Button.vue +0 -69
  182. package/MediaDemo/components/Controllor.vue +0 -286
  183. package/MediaDemo/components/StatusBar.vue +0 -100
  184. package/MediaDemo/components/frames/AudioFrame.vue +0 -39
  185. package/MediaDemo/components/frames/AudioPoster.vue +0 -48
  186. package/MediaDemo/components/frames/MediaFrame.vue +0 -153
  187. package/MediaDemo/components/frames/VideoFrame.vue +0 -39
  188. package/MetroWidgetDemos/TripleWidget/App.vue +0 -87
  189. package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +0 -99
  190. package/Parkour/App.vue +0 -13
  191. package/Parkour/Common/Context.js +0 -21
  192. package/Parkour/Common/MatchmanInfo.js +0 -62
  193. package/Parkour/Common/Random.js +0 -61
  194. package/Parkour/Common/Sound.js +0 -50
  195. package/Parkour/appConfig/HOW_TO_CONFIG.md +0 -20
  196. package/Parkour/appConfig/app.config.mjs +0 -5
  197. package/Parkour/appConfig/app_sign_private_key_sample.crt +0 -28
  198. package/Parkour/appConfig/app_sign_public_key_sample.pem +0 -9
  199. package/Parkour/appConfig/jsview.config.mjs +0 -39
  200. package/Parkour/assets/Bgimages/bg1.png +0 -0
  201. package/Parkour/assets/Bgimages/bg2.png +0 -0
  202. package/Parkour/assets/Bgimages/bg3.png +0 -0
  203. package/Parkour/assets/Bgimages/bg4.png +0 -0
  204. package/Parkour/assets/Bgimages/bg5.png +0 -0
  205. package/Parkour/assets/audio/jump.mp3 +0 -0
  206. package/Parkour/assets/audio/lose.mp3 +0 -0
  207. package/Parkour/assets/role_skin1/fail.json +0 -44
  208. package/Parkour/assets/role_skin1/fail.png +0 -0
  209. package/Parkour/assets/role_skin1/jump_down.json +0 -20
  210. package/Parkour/assets/role_skin1/jump_down.png +0 -0
  211. package/Parkour/assets/role_skin1/jump_up.json +0 -44
  212. package/Parkour/assets/role_skin1/jump_up.png +0 -0
  213. package/Parkour/assets/role_skin1/roll.json +0 -44
  214. package/Parkour/assets/role_skin1/roll.png +0 -0
  215. package/Parkour/assets/role_skin1/run.json +0 -52
  216. package/Parkour/assets/role_skin1/run.png +0 -0
  217. package/Parkour/components/Backdrop.vue +0 -61
  218. package/Parkour/components/GameSence.vue +0 -602
  219. package/Parkour/components/Matchman.vue +0 -85
  220. package/ThrowMoveDemo/AccelerateDemo.vue +0 -85
  221. package/ThrowMoveDemo/App.vue +0 -104
  222. package/ThrowMoveDemo/LRParabolicDemo.vue +0 -101
  223. package/ThrowMoveDemo/TargetDemo.vue +0 -87
  224. package/ThrowMoveDemo/UDParabolicDemo.vue +0 -92
  225. /package/{AnimPicture/assets → assets}/animated_webp.webp +0 -0
  226. /package/{AnimPicture/assets → assets}/ball_3.webp +0 -0
  227. /package/{AnimPicture/assets → assets}/girl_run.gif +0 -0
  228. /package/{AnimPicture/assets → assets}/quan.webp +0 -0
@@ -1,85 +0,0 @@
1
- <!--
2
- * @Author: ChenChanghua
3
- * @Date: 2021-09-22 13:47:23
4
- * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-02-11 17:55:55
6
- * @Description: file content
7
- -->
8
- <script>
9
- import GridItem from "./GridItem.vue";
10
-
11
- export default {
12
- props: {
13
- data: Object,
14
- height: {
15
- type: Number,
16
- required: true,
17
- },
18
- width: {
19
- type: Number,
20
- required: true,
21
- },
22
- measures: {
23
- type: Function,
24
- required: true,
25
- },
26
- },
27
- components: {
28
- GridItem,
29
- },
30
- created() {
31
- this.configWidth = this.width;
32
- this.configHeight = this.height;
33
-
34
- // 通过measure函数,计算item信息
35
- let measure_result = this.measures();
36
- let current_line_x = 0;
37
- let current_line_y = 0;
38
- for (let idx = 0; idx < this.data.length; idx++) {
39
- if (current_line_x + measure_result.width > this.configWidth) {
40
- // new line
41
- current_line_x = 0;
42
- current_line_y += measure_result.height;
43
- }
44
-
45
- this.itemData.push(
46
- Object.freeze({
47
- id: idx,
48
- xPos: current_line_x,
49
- yPos: current_line_y,
50
- data: this.data[idx],
51
- })
52
- );
53
-
54
- // next item x
55
- current_line_x += measure_result.width;
56
- }
57
- },
58
- setup() {
59
- return {
60
- configWidth: 0,
61
- configHeight: 0,
62
- itemData: [],
63
- };
64
- },
65
- mounted() {},
66
- updated() {},
67
- };
68
- </script>
69
-
70
- <template>
71
- <div
72
- :style="{ width: configWidth, height: configHeight, overflow: 'hidden' }"
73
- >
74
- <grid-item
75
- v-for="(item, index) in itemData"
76
- :key="item.id"
77
- :index="index"
78
- :data="item"
79
- >
80
- <template v-slot:renderItem="slotProps">
81
- <slot name="renderItem" v-bind="slotProps"></slot>
82
- </template>
83
- </grid-item>
84
- </div>
85
- </template>
package/MediaDemo/App.vue DELETED
@@ -1,127 +0,0 @@
1
- <script>
2
- import { provide, reactive, watch } from 'vue'
3
- import { Options, Vue } from "vue-class-component";
4
- import AudioFrame from "./components/frames/AudioFrame";
5
- import VideoFrame from "./components/frames/VideoFrame";
6
- import Controllor from "./components/Controllor";
7
- import StatusBar from "./components/StatusBar";
8
-
9
- @Options({
10
- components: {
11
- AudioFrame,
12
- VideoFrame,
13
- Controllor,
14
- StatusBar,
15
- },
16
- })
17
-
18
- class App extends Vue {
19
- constructor(props) {
20
- super(props);
21
-
22
- this.mediaCtrl = reactive({
23
- type: 'video',
24
- autoplay: true,
25
- seek: 0,
26
- loop: false,
27
- mute: false,
28
- volume: 0,
29
- playbackRate: 1,
30
-
31
- playTrigger: 0,
32
- loadTrigger: 0,
33
- })
34
- this.mediaTime = reactive({
35
- currentTime: 0,
36
- duration: 0,
37
- })
38
- this.mediaStatus = reactive({
39
- playState: '',
40
- playbackRate: '',
41
- objectFit: '',
42
- volume: '',
43
- playing: false,
44
- })
45
- this.videoCtrl = reactive({
46
- layout: {},
47
- objectFit: null,
48
- visibility: 'visible',
49
- })
50
-
51
- const updateCaption = () => {
52
- this.caption = (this.mediaCtrl.type == 'audio' ? App.Caption.audioInfo : App.Caption.videoInfo);
53
- };
54
- watch(() => this.mediaCtrl.type, updateCaption);
55
- updateCaption();
56
-
57
- provide('mediaCtrl', this.mediaCtrl)
58
- provide('mediaTime', this.mediaTime)
59
- provide('mediaStatus', this.mediaStatus)
60
- provide('videoCtrl', this.videoCtrl)
61
- }
62
-
63
- static Caption = {
64
- videoInfo: "名称: Video\n"
65
- + "功能描述:\n"
66
- + "1. 播放 / 暂停\n"
67
- + "2. 前进 / 后退\n"
68
- + "3. 时间 / 时长\n"
69
- + "4. 循环 / 静音 / 倍速\n"
70
- + "5. ObjectFit调整\n",
71
- audioInfo: "名称: Audio\n"
72
- + "功能描述:\n"
73
- + "1. 播放 / 暂停\n"
74
- + "2. 前进 / 后退\n"
75
- + "3. 时间 / 时长 / 倍速\n"
76
- + "4. 循环 / 静音\n"
77
- }
78
- }
79
-
80
- export default App;
81
- </script>
82
-
83
- <template>
84
- <div
85
- :style="{
86
- top: 0, left: 0,
87
- width: 1280, height: 720,
88
- backgroundColor: 'rgb(222,211,140,0.5)'
89
- }"
90
- >
91
-
92
- <AudioFrame v-if="mediaCtrl.type == 'audio'"/>
93
- <VideoFrame v-else />
94
-
95
- <!-- :key="mediaCtrl.type" => JsView bug,当mediaCtrl.type属性变化时,为了保证显示在VideoFrame前面 -->
96
- <div class="caption" :key="mediaCtrl.type">
97
- {{ caption }}
98
- </div>
99
- <Controllor class="controllor"/>
100
- <StatusBar class="statusbar"/>
101
- </div>
102
- </template>
103
-
104
- <style scoped>
105
- .caption {
106
- text-align: left;
107
- font-size: 24;
108
- line-height: 30;
109
- color: #FFFFFF;
110
- left: 40;
111
- top: 20;
112
- width: 300;
113
- height: 210;
114
- background-color: rgba(27,38,151,0.6);
115
- }
116
-
117
- .controllor {
118
- left: 40;
119
- top: 540;
120
- }
121
-
122
- .statusbar {
123
- left: 40;
124
- top: 650;
125
- }
126
-
127
- </style>
Binary file
@@ -1,69 +0,0 @@
1
- <script>
2
- import { Options, Vue } from "vue-class-component";
3
-
4
- @Options({
5
- props: {
6
- style: Object,
7
- autoFocus: Boolean,
8
- name: String,
9
- onClick: Function,
10
- }
11
- })
12
-
13
- class Button extends Vue {
14
- constructor(props) {
15
- super(props);
16
-
17
- this.hasFocused = false;
18
- }
19
-
20
- onFocus() {
21
- this.hasFocused = true;
22
- }
23
-
24
- onBlur() {
25
- this.hasFocused = false;
26
- }
27
-
28
- onKeyDown(ev) {
29
- if(ev.keyCode === 13) { // Enter
30
- this.onClick?.();
31
- return true;
32
- }
33
- return false;
34
- }
35
-
36
- getAction() {
37
- return {
38
- onFocus: this.onFocus,
39
- onBlur: this.onBlur,
40
- onKeyDown: this.onKeyDown
41
- }
42
- }
43
- }
44
-
45
- export default Button;
46
- </script>
47
-
48
- <template>
49
- <jsv-focus-block :name="name" :autoFocus="autoFocus?'':undefined"
50
- :onAction="getAction()"
51
- >
52
- <div class="item"
53
- :style="{
54
- ...style,
55
- backgroundColor: hasFocused ? '#FFFF00' : '#A8A8A8',
56
- }"
57
- >
58
- <slot/>
59
- </div>
60
- </jsv-focus-block>
61
- </template>
62
-
63
- <style scoped>
64
- .item {
65
- text-align: center;
66
- font-size: 24;
67
- line-height: 40;
68
- }
69
- </style>
@@ -1,286 +0,0 @@
1
- <script>
2
- import { inject } from 'vue'
3
- import { Options, Vue } from "vue-class-component";
4
- import { useFocusHub } from 'jsview';
5
- import Button from "./Button.vue";
6
-
7
- @Options({
8
- props: {
9
- style: { type: Object, default: {width:1400,height:50} },
10
- },
11
- components: {
12
- Button,
13
- },
14
- })
15
-
16
- class Controllor extends Vue {
17
- constructor(props) {
18
- super(props);
19
-
20
- this.mediaCtrl = inject('mediaCtrl');
21
- this.mediaTime = inject('mediaTime');
22
- this.mediaStatus = inject('mediaStatus');
23
- this.videoCtrl = inject('videoCtrl');
24
-
25
- this.buttonList = this.getButtonList();
26
-
27
- this.playbackRateData = [
28
- { name: "1.0", playbackRate: 1.0 },
29
- { name: "2.0", playbackRate: 2.0 },
30
- { name: "4.0", playbackRate: 4.0 },
31
- { name: "0.5", playbackRate: 0.5 },
32
- { name: "0.25", playbackRate: 0.25 },
33
- { name: "-1.0", playbackRate: -1.0 },
34
- ];
35
- this.playbackRateIndex = 0;
36
-
37
- this.objectFitData = [
38
- { name: "contain-horizontal", objectFit: "contain", width: 1200 },
39
- { name: "contain-vertical", objectFit: "contain", width: 400 },
40
- { name: "fill", objectFit: "fill", width: 1200 },
41
- { name: "cover-horizontal", objectFit: "cover", width: 1200 },
42
- { name: "cover-vertical", objectFit: "cover", width: 400 },
43
- ];
44
- this.objectFitIndex = 0;
45
-
46
- this.buttonRowCount = 7;
47
- this.focusedItemIndex = 0;
48
- }
49
-
50
- created() {
51
- this.setPlaybackRate(0);
52
- this.setObjectFit(0);
53
- }
54
-
55
- setup() {
56
- return {
57
- focusHub: useFocusHub()
58
- }
59
- }
60
-
61
- onKeyDown(ev) {
62
- // 8:Backspace, 27:Escape, 10000:盒子返回键
63
- if(ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
64
- this.$router?.go(-1); // 有router时,回退
65
- return true;
66
- }
67
-
68
- let focusStep = 0;
69
- let autoFindNext = false;
70
- switch (ev.keyCode) {
71
- case 37: // Left
72
- focusStep = -1;
73
- autoFindNext = true;
74
- break;
75
- case 39: // Right
76
- focusStep = 1;
77
- autoFindNext = true;
78
- break;
79
- case 38: // Up
80
- focusStep = -this.buttonRowCount;
81
- break;
82
- case 40: // Down
83
- focusStep = this.buttonRowCount;
84
- break;
85
- default:
86
- break;
87
- }
88
-
89
- const buttonData = this.getButtonData();
90
- const buttonAllCount = this.buttonRowCount * 2;
91
- let newFocusIdx = this.focusedItemIndex;
92
- let hasNextFocusItem = false;
93
- while(true) {
94
- newFocusIdx = (newFocusIdx + focusStep + buttonAllCount) % buttonAllCount;
95
- if(!buttonData[newFocusIdx]?.name) {
96
- if(autoFindNext) {
97
- continue;
98
- } else {
99
- break;
100
- }
101
- }
102
-
103
- hasNextFocusItem = true;
104
- break;
105
- };
106
-
107
- if(hasNextFocusItem) {
108
- this.focusHub.setFocus('controllor.' + 'btn-' + newFocusIdx);
109
- this.focusedItemIndex = newFocusIdx;
110
- return true;
111
- }
112
-
113
- return false;
114
- }
115
-
116
- getButtonList() {
117
- const buttonList = [{
118
- name: "To AudioMode",
119
- onClick: () => {
120
- this.mediaCtrl.type = (this.mediaCtrl.type == 'audio' ? 'video' : 'audio');
121
- this.mediaCtrl.autoplay = true; // 自动播放
122
- this.mediaCtrl.mute = false; // 关闭静音
123
- this.mediaCtrl.loop = false; // 关闭循环
124
- this.mediaTime.currentTime = 0;
125
- this.mediaTime.duration = 0;
126
- this.mediaCtrl.playTrigger = 0; // 停止并初始化播放
127
- this.setPlaybackRate(0);
128
- this.setObjectFit(0);
129
- this.videoCtrl.visibility = 'visible';
130
- if(this.mediaCtrl.type == 'audio') {
131
- this.mediaStatus.objectFit = '';
132
- this.videoCtrl.visibility = '';
133
- }
134
-
135
- this.focusedItemIndex = 0;
136
- },
137
- isModeButton: true,
138
- }, {
139
- name: "Play",
140
- onClick: () => {
141
- this.mediaCtrl.playTrigger = ++this.mediaCtrl.playTrigger; /* 为了触发ref更新 */
142
- },
143
- isPlayButton: true,
144
- }, {
145
- name: "Rewind <<",
146
- onClick: () => {
147
- this.mediaCtrl.seek = (this.mediaCtrl.seek !== -10 ? -10 : -10.1/* 为了触发ref更新 */);
148
- }
149
- }, {
150
- name: "Forward >>",
151
- onClick: () => {
152
- this.mediaCtrl.seek = (this.mediaCtrl.seek !== +10 ? +10 : +10.1/* 为了触发ref更新 */);
153
- }
154
- }, {
155
- name: "Reload",
156
- onClick: () => {
157
- this.mediaCtrl.loadTrigger = ++this.mediaCtrl.loadTrigger; /* 为了触发ref更新 */
158
- },
159
- }, {
160
- name: "Loop Off",
161
- onClick: () => {
162
- this.mediaCtrl.loop = !this.mediaCtrl.loop;
163
- },
164
- isLoopButton: true,
165
- }, {
166
- name: "ObjectFit",
167
- onClick: this.setObjectFit.bind(this)
168
- }, {
169
- // 空,按钮对其用
170
- }, {
171
- name: "Mute Off",
172
- onClick: () => {
173
- this.mediaCtrl.mute = !this.mediaCtrl.mute;
174
- },
175
- isMuteButton: true,
176
- }, {
177
- name: "Volume",
178
- onClick: () => {
179
- this.mediaCtrl.volume = (this.mediaCtrl.volume !== 0.2 ? 0.2 : 0.21/* 为了触发ref更新 */);
180
- }
181
- }, {
182
- name: "Rate",
183
- onClick: this.setPlaybackRate.bind(this)
184
- }, {
185
- name: "Visibility",
186
- onClick: () => {
187
- this.videoCtrl.visibility = (this.videoCtrl.visibility != 'visible' ? 'visible' : 'hidden');
188
- },
189
- },
190
- ];
191
-
192
- return buttonList;
193
- }
194
-
195
- getButtonData() {
196
- const buttonWidth = 158;
197
- const buttonHeight = 40;
198
- const buttonSpacing = 15;
199
-
200
- let data = [];
201
- const length = this.buttonList.length;
202
- for(let idx = 0; idx < length; idx++) {
203
- let button = this.buttonList[idx];
204
- if(this.mediaCtrl.type == 'audio'
205
- && (button.name == 'ObjectFit'
206
- || button.name == 'Visibility')) { // 只有video方式可以做ObjectFit和visibility
207
- button = {};
208
- }
209
-
210
- data.push({
211
- ...button,
212
- layout: {
213
- left: (buttonWidth + buttonSpacing) * (idx % this.buttonRowCount),
214
- top: (buttonHeight + buttonSpacing) * Math.floor(idx / this.buttonRowCount),
215
- width: buttonWidth,
216
- height: buttonHeight,
217
- }
218
- });
219
- }
220
- return data;
221
- }
222
-
223
- setPlaybackRate(index) {
224
- if(typeof index === 'number') {
225
- this.playbackRateIndex = index;
226
- } else {
227
- this.playbackRateIndex = (++this.playbackRateIndex % this.playbackRateData.length);
228
- }
229
- const data = this.playbackRateData[this.playbackRateIndex];
230
- this.mediaStatus.playbackRate = data.name;
231
- this.mediaCtrl.playbackRate = data.playbackRate;
232
- }
233
-
234
- setObjectFit(index) {
235
- if(typeof index === 'number') {
236
- this.objectFitIndex = index;
237
- } else {
238
- this.objectFitIndex = (++this.objectFitIndex % this.objectFitData.length);
239
- }
240
- const data = this.objectFitData[this.objectFitIndex];
241
- this.mediaStatus.objectFit = data.name;
242
- this.videoCtrl.objectFit = data.objectFit;
243
- this.videoCtrl.layout = {
244
- left: (1280 - data.width) / 2, top: 20,
245
- width: data.width, height: 500,
246
- }
247
- }
248
-
249
- getShowName(item) {
250
- if(item.isModeButton) {
251
- return this.mediaCtrl.type == 'audio' ? "To VideoMode" : "To AudioMode";
252
- } else if(item.isPlayButton) {
253
- return this.mediaStatus.playing ? 'Pause' : 'Play'
254
- } else if(item.isLoopButton) {
255
- return this.mediaCtrl.loop ? 'Loop Off' : 'Loop On'
256
- } else if(item.isMuteButton) {
257
- return this.mediaCtrl.mute ? 'Mute Off' : 'Mute On'
258
- }
259
-
260
- return item.name;
261
- }
262
- }
263
-
264
- export default Controllor;
265
- </script>
266
-
267
- <template>
268
- <div :style="style" :key="mediaCtrl.type + mediaCtrl.loop + mediaCtrl.mute + mediaStatus.playing">
269
- <jsv-focus-block namespace="controllor" :onKeyDown="onKeyDown">
270
- <div v-for="(item,index) in getButtonData()" :key="index">
271
- <Button v-if="item.name"
272
- :style="{ left: item.layout.left, top: item.layout.top,
273
- width:item.layout.width, height:item.layout.height }"
274
- :autoFocus="index === focusedItemIndex"
275
- :name="'btn-' + index"
276
- :onClick="item.onClick"
277
- >
278
- {{ getShowName(item) }}
279
- </Button>
280
- </div>
281
- </jsv-focus-block>
282
- </div>
283
- </template>
284
-
285
- <style scoped>
286
- </style>
@@ -1,100 +0,0 @@
1
- <script>
2
- import { inject } from 'vue'
3
- import { Options, Vue } from "vue-class-component";
4
-
5
- @Options({
6
- })
7
- class StatusBar extends Vue {
8
- constructor(props) {
9
- super(props);
10
-
11
- this.mediaCtrl = inject('mediaCtrl');
12
- this.mediaTime = inject('mediaTime');
13
- this.mediaStatus = inject('mediaStatus');
14
- this.videoCtrl = inject('videoCtrl');
15
- }
16
- }
17
-
18
- export default StatusBar;
19
- </script>
20
-
21
- <template>
22
- <div>
23
- <div class="text progress">
24
- {{ 'progress:' + Math.ceil(mediaTime.currentTime) + '/' + Math.ceil(mediaTime.duration) }}
25
- </div>
26
- <div class="text mute">
27
- {{ mediaCtrl.mute ? 'muted' : '-' }}
28
- </div>
29
- <div class="text volume">
30
- {{ 'volume:' + mediaStatus.volume }}
31
- </div>
32
- <div class="text rate">
33
- {{ mediaStatus.playbackRate }}
34
- </div>
35
- <div class="text visibility" :key="videoCtrl.visibility">
36
- {{ videoCtrl.visibility }}
37
- </div>
38
- <div class="text loop">
39
- {{ mediaCtrl.loop ? 'looping' : '-' }}
40
- </div>
41
- <div class="text objectFit" :key="mediaStatus.objectFit">
42
- {{ mediaStatus.objectFit }}
43
- </div>
44
- <div class="text status">
45
- {{ 'status: ' + mediaStatus.playState }}
46
- </div>
47
- </div>
48
- </template>
49
-
50
- <style scoped>
51
- .text {
52
- color: #FF0000;
53
- font-size: 24;
54
- width: 158;
55
- height: 40;
56
- }
57
-
58
- .progress {
59
- left: 0;
60
- width: 300;
61
- }
62
-
63
- .mute {
64
- left: 173; /* (158+15)*1 */
65
- text-align: center;
66
- }
67
-
68
- .volume {
69
- left: 346; /* (158+15)*2 */
70
- text-align: center;
71
- }
72
-
73
- .rate {
74
- left: 519; /* (158+15)*3 */
75
- text-align: center;
76
- }
77
-
78
- .visibility {
79
- left: 692; /* (158+15)*4 */
80
- text-align: center;
81
- }
82
-
83
- .loop {
84
- left: 865; /* (158+15)*5 */
85
- text-align: center;
86
- }
87
-
88
- .objectFit {
89
- left: 1020; /* (158+15)*6-x */
90
- width: 190;
91
- text-align: center;
92
- }
93
-
94
- .status {
95
- left: 0;
96
- top: 30;
97
- width: 800;
98
- }
99
-
100
- </style>
@@ -1,39 +0,0 @@
1
- <script>
2
- import { inject, watch } from 'vue'
3
- import { Options, Vue } from "vue-class-component";
4
- import AudioPoster from "./AudioPoster";
5
- import MediaFrame from "./MediaFrame";
6
-
7
- @Options({
8
- components: {
9
- AudioPoster,
10
- MediaFrame,
11
- },
12
- })
13
- class AudioFrame extends Vue {
14
- constructor(props) {
15
- super(props);
16
-
17
- this.mediaStatus = inject('mediaStatus');
18
-
19
- this.audioUrl = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/MediaDemo/components/frames/AudioFrame/demo_test.mp3";
20
- // is.audioUrl = "http://192.168.1.99/videos/empty.mp3";
21
- }
22
- }
23
-
24
- export default AudioFrame;
25
- </script>
26
-
27
- <template>
28
- <MediaFrame
29
- tagName="audio"
30
- :src="audioUrl"
31
- />
32
-
33
- <AudioPoster
34
- :playing="this.mediaStatus.playing"
35
- />
36
- </template>
37
-
38
- <style scoped>
39
- </style>