blog/source/_posts/Resolve-Jellyfin-10-6-x-subtitles.md
2020-09-26 17:02:49 +09:00

49 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 解决 Jellyfin 10.6.x 中文字幕方块问题
date: 2020-09-01 12:02:33
tags:
- jellyfin
- subtitles
- chinese
---
{% blockquote %}
本文参考 {% link 完美解决 Jellyfin 网页播放器 ASS 中文字幕显示方块的问题 http://www.nasyun.com/forum.php?mod=viewthread&tid=71658 %} 修改而来。
{% endblockquote %}
### 下载字体
字幕方块是由于默认字体不包含中文字符集造成的,可以下载官方扩展字体:[NotoCJK](https://github.com/jellyfin/jellyfin-web/files/4434292/noto.zip)。
也可以下载该博客提供的 {% asset_link FZZY_GBK.woff2.zip 方正准圆的 woff2 版本 %}。
### 修改文件
由于我使用的是 docker 来安装 jellyfin所以这里说下 docker 下的修改方法。
<!-- more -->
```shell
root@DSM# docker exec -it jellyfin /bin/bash
/# cp /jellyfin/jellyfin-web/plugins/htmlVideoPlayer/plugin.js /media/
```
进入 `/media` 所映射的 `NAS` 目录下,打开 `plugin.js` 文件修改:
定位到 `fonts:`,做下列替换
```diff
- apiClient=connectionManager.getApiClient(item)
+ attachmentsFonts=attachments.map(function(i){return i.DeliveryUrl})
```
```diff
- fonts:attachments.map(function(i){return apiClient.getUrl(i.DeliveryUrl)})
+ fonts:attachmentsFonts.concat(appRouter.baseUrl()+"/libraries/FZZY_GBK.woff2")
```
把字体文件解压至 `/media` 对应的目录。
```shell
/# cp /media/FZZY_GBK.woff2 /jellyfin/jellyfin-web/libraries/
/# cp /media/plugin.js /jellyfin/jellyfin-web/plugins/htmlVideoPlayer/
```
### 查看效果
清除浏览器缓存,刷新后打开视频就可以看到中文字幕正常显示了。