askbot-dragon 1.7.87-beta → 1.7.89-beta

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.7.87-beta",
3
+ "version": "1.7.89-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -61,6 +61,37 @@
61
61
  console.debug('newVideoSrc',this.videoSrc,videoSrc)
62
62
  this.poster = this.videoSrc+'?spm=qipa250&x-oss-process=video/snapshot,t_1000,f_jpg,w_0,h_0,m_fast'
63
63
  console.debug('poster',this.poster)
64
+ /* 安卓手机播放视频默认全屏设置 ios默认就是全屏 */
65
+ let id = this.msg.id + 'key'
66
+ const video = document.getElementById(id);
67
+ const videoContainer = document.getElementById('dragon-video');
68
+ // 仅在 Android 设备尝试自动全屏
69
+ const isAndroid = /Android/i.test(navigator.userAgent);
70
+ if (isAndroid){
71
+ video.addEventListener('play', async () => {
72
+ // 仅在全屏请求由用户触发时有效(如点击播放按钮后)
73
+ try {
74
+ // 1. 先进入全屏
75
+ await video.requestFullscreen();
76
+
77
+ // 2. 锁定竖屏方向(需浏览器支持)
78
+ if (screen.orientation?.lock) {
79
+ await screen.orientation.lock('portrait');
80
+ }
81
+ } catch (err) {
82
+ console.error('全屏失败:', err);
83
+ videoContainer.classList.add('force-fullscreen'); // 降级方案
84
+ }
85
+ });
86
+ // 点击关闭按钮或按 ESC 退出
87
+ document.addEventListener('fullscreenchange', () => {
88
+ if (!document.fullscreenElement) {
89
+ console.debug('fullscreenchange')
90
+ videoContainer.classList.remove('force-fullscreen');
91
+ }
92
+ });
93
+ }
94
+
64
95
  })
65
96
 
66
97
  },
@@ -118,7 +149,7 @@
118
149
  //转换成成blob对象
119
150
  /*return new Blob([u8arr],{type:'image/png'});*/
120
151
  }
121
- }
152
+ },
122
153
 
123
154
  }
124
155
  </script>
@@ -158,5 +189,20 @@ video::-webkit-media-controls-mute-button { display: none !important;}
158
189
  }
159
190
  }
160
191
  }
192
+ /* 强制竖屏全屏样式 */
193
+ .force-fullscreen {
194
+ position: fixed !important;
195
+ top: 0 !important;
196
+ left: 0 !important;
197
+ width: 100vw !important;
198
+ height: 100vh !important;
199
+ object-fit: contain !important;
200
+ background: black !important;
201
+ z-index: 9999 !important;
202
+ }
161
203
 
204
+ /* 隐藏原生控件(可选) */
205
+ .force-fullscreen::-webkit-media-controls {
206
+ display: none !important;
207
+ }
162
208
  </style>