File tree Expand file tree Collapse file tree 3 files changed +27
-6
lines changed
renderer/src/components/modules/player/setting/items/subtitle Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,6 @@ afterPack: scripts/cleaned-unused-arch-deps.js
6868afterSign : scripts/notarize.js
6969releaseInfo :
7070 releaseNotes : |
71- 优化提示信息
72- 修复改变窗口大小字幕消失的问题
71+ 优化导入字幕提示信息
72+ 修复改变窗口大小后字幕消失的问题
7373
Original file line number Diff line number Diff line change @@ -96,8 +96,28 @@ export default class FFmpeg {
9696 . on ( 'end' , ( ) => {
9797 resolve ( outputPath )
9898 } )
99- . on ( 'error' , ( err ) => {
100- reject ( err )
99+ . on ( 'error' , async ( ffmpegError ) => {
100+ ffmpeg . ffprobe ( this . ffmpeg . _inputs [ 0 ] . source , ( err , metadata ) => {
101+ if ( err ) {
102+ return reject ( err )
103+ }
104+
105+ const subtitleStream = metadata . streams
106+ . filter ( ( stream ) => stream . codec_type === 'subtitle' )
107+ . at ( index )
108+
109+ if ( ! subtitleStream ) {
110+ return reject ( new Error ( '解析内嵌字幕发生错误' ) )
111+ }
112+ // 检查是否为 PGS 字幕
113+ if (
114+ subtitleStream . codec_name ?. toLowerCase ( ) ?. includes ( 'pgs' ) ||
115+ subtitleStream . codec_tag_string ?. toLowerCase ( ) ?. includes ( 'pgs' )
116+ ) {
117+ return reject ( new Error ( '不支持加载「位图字幕」' ) )
118+ }
119+ reject ( ffmpegError )
120+ } )
101121 } )
102122 } )
103123 }
Original file line number Diff line number Diff line change @@ -156,10 +156,11 @@ export const useSubtitle = () => {
156156 } )
157157 const subtitlePath = subtitleData ?. data
158158 if ( ! subtitlePath || ! data ?. tags ?. [ index ] ) {
159+ const message = subtitleData ?. message ?? '视频内嵌字幕加载失败'
159160 toast ( {
160- title : '视频内嵌字幕加载失败' ,
161+ title : message
161162 } )
162- throw new Error ( subtitleData ?. message ?? '字幕加载失败' )
163+ throw new Error ( message )
163164 }
164165
165166 const newTags = [
You can’t perform that action at this time.
0 commit comments