Skip to content

Commit

Permalink
fix(xgplayer): 增加繁体支持;完善types(lang、preload);画中画drag支持国际化
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxin92 committed Aug 4, 2020
1 parent 0e26de8 commit 6111e06
Show file tree
Hide file tree
Showing 13 changed files with 221 additions and 64 deletions.
12 changes: 6 additions & 6 deletions packages/xgplayer/browser/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/xgplayer/browser/index.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/xgplayer/browser/simple_player.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/xgplayer/browser/simple_player.js.map

Large diffs are not rendered by default.

103 changes: 81 additions & 22 deletions packages/xgplayer/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/xgplayer/dist/index.js.map

Large diffs are not rendered by default.

103 changes: 81 additions & 22 deletions packages/xgplayer/dist/simple_player.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/xgplayer/dist/simple_player.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/xgplayer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xgplayer",
"version": "2.9.9",
"version": "2.9.11",
"description": "video player",
"main": "./dist/index.js",
"typings": "./types/index.d.ts",
Expand Down
36 changes: 36 additions & 0 deletions packages/xgplayer/src/controls/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let i18n = function () {
SCREENSHOT: 'Screenshot',
LIVE: 'LIVE',
OFF: 'Off',
PIP_DRAG: 'Click and hold to drag',
}
lang['zh-cn'] = {
HAVE_NOTHING: '没有关于音频/视频是否就绪的信息',
Expand Down Expand Up @@ -65,6 +66,40 @@ let i18n = function () {
SCREENSHOT: '截图',
LIVE: '正在直播',
OFF: '关闭',
PIP_DRAG: '点击按住可拖动视频',
}
lang['zh-hk'] = {
HAVE_NOTHING: '沒有關於音頻/視頻是否就緒的信息',
HAVE_METADATA: '音頻/視頻的元數據已就緒',
HAVE_CURRENT_DATA: '關於當前播放位置的數據是可用的,但沒有足夠的數據來播放下壹幀/毫秒',
HAVE_FUTURE_DATA: '當前及至少下壹幀的數據是可用的',
HAVE_ENOUGH_DATA: '可用數據足以開始播放',
NETWORK_EMPTY: '音頻/視頻尚未初始化',
NETWORK_IDLE: '音頻/視頻是活動的且已選取資源,但並未使用網絡',
NETWORK_LOADING: '瀏覽器正在下載數據',
NETWORK_NO_SOURCE: '未找到音頻/視頻來源',
MEDIA_ERR_ABORTED: '取回過程被用戶中止',
MEDIA_ERR_NETWORK: '當下載時發生錯誤',
MEDIA_ERR_DECODE: '當解碼時發生錯誤',
MEDIA_ERR_SRC_NOT_SUPPORTED: '不支持的音頻/視頻格式',
REPLAY: '重播',
ERROR: '網絡連接似乎出現了問題',
PLAY_TIPS: '播放',
PAUSE_TIPS: '暫停',
PLAYNEXT_TIPS: '下壹集',
DOWNLOAD_TIPS: '下載',
ROTATE_TIPS: '旋轉',
RELOAD_TIPS: '重新載入',
FULLSCREEN_TIPS: "進入全屏",
EXITFULLSCREEN_TIPS: '退出全屏',
CSSFULLSCREEN_TIPS: '進入樣式全屏',
EXITCSSFULLSCREEN_TIPS: '退出樣式全屏',
TEXTTRACK: '字幕',
PIP: '畫中畫',
SCREENSHOT: '截圖',
LIVE: '正在直播',
OFF: '關閉',
PIP_DRAG: '點擊按住可拖動視頻',
}
lang['jp'] = {
HAVE_NOTHING: 'オーディオ/ビデオが準備できているか情報がありません',
Expand Down Expand Up @@ -97,6 +132,7 @@ let i18n = function () {
SCREENSHOT: 'スクリーンショット',
LIVE: '生放送',
OFF: 'オフ',
PIP_DRAG: 'ボタンを押して働画をドラッグする',
}

Object.defineProperty(player, 'lang', {
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class Player extends Proxy {
// let Left = ro.left
let dragLay = util.createDom('xg-pip-lay', '<div></div>', {}, 'xgplayer-pip-lay')
this.root.appendChild(dragLay)
let dragHandle = util.createDom('xg-pip-drag', '<div class="drag-handle"><span>点击按住可拖动视频</span></div>', {tabindex: 9}, 'xgplayer-pip-drag')
let dragHandle = util.createDom('xg-pip-drag', `<div class="drag-handle"><span>${this.lang.PIP_DRAG}</span></div>`, {tabindex: 9}, 'xgplayer-pip-drag')
this.root.appendChild(dragHandle)
// eslint-disable-next-line no-unused-vars
let draggie = new Draggabilly('.xgplayer', {
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/skin/style/controls/fullscreen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}
}

.xgplayer-skin-default.xgplayer-is-fullscreen {
.xgplayer-skin-default.xgplayer-is-fullscreen, .xgplayer-skin-default.xgplayer-rotate-fullscreen{
.xgplayer-fullscreen, .xgplayer-fullscreen-img {
.xgplayer-icon {
.xgplayer-icon-requestfull {
Expand Down
5 changes: 4 additions & 1 deletion packages/xgplayer/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ declare module 'xgplayer' {
// 循环播放(默认false)
loop?: boolean;

// 预加载
preload?: string;

// 初始化显示视频首帧(默认false,该配置在移动端无效)
videoInit?: boolean;

Expand Down Expand Up @@ -228,7 +231,7 @@ declare module 'xgplayer' {
pluginRule?: () => boolean;

// 国际化
lang?: 'zh-cn' | 'en' | 'jp';
lang?: string | object;

// 白名单
// 手机上video表现各异,自定义UI会有意想不到的情况发生,为了安全起见,播放器在手机上会关掉自定义UI功能,开发者可以通过白名单的方式开启此项功能
Expand Down

0 comments on commit 6111e06

Please sign in to comment.