diff --git a/packages/yyeva/README.en.md b/packages/yyeva/README.en.md
index 8e9d892..6839ed0 100644
--- a/packages/yyeva/README.en.md
+++ b/packages/yyeva/README.en.md
@@ -37,7 +37,7 @@ let player:YYEvaType = await yyEva({
})
player.start() // start player
player.stop() // pause player
-player.destory() // dstory player
+player.destroy() // destroy player
```
## configuration
| options | effect | defaults |required|
@@ -79,4 +79,4 @@ WeChat ios has been verified and can be played automatically
WeChat Android needs to be manually clicked or customized according to the `onRequestClickPlay` event
### Wechat Miniprogram
-[NPM Package](https://www.npmjs.com/package/yyeva-wechat)
\ No newline at end of file
+[NPM Package](https://www.npmjs.com/package/yyeva-wechat)
diff --git a/packages/yyeva/README.md b/packages/yyeva/README.md
index b7fae27..222db74 100644
--- a/packages/yyeva/README.md
+++ b/packages/yyeva/README.md
@@ -37,7 +37,7 @@ let player:YYEvaType = await yyEva({
})
player.start() // start player
player.stop() // pause player
-player.destory() // dstory player
+player.destroy() // destroy player
```
## 配置
| 选项 | 作用 | 默认值 |必填|
diff --git a/packages/yyeva/package.json b/packages/yyeva/package.json
index 56067a4..efd1ee0 100644
--- a/packages/yyeva/package.json
+++ b/packages/yyeva/package.json
@@ -1,6 +1,6 @@
{
"name": "yyeva",
- "version": "1.0.0-rc.21",
+ "version": "1.0.0-rc.23",
"description": "mp4 gift player",
"files": [
"dist",
diff --git a/packages/yyeva/src/player/index.ts b/packages/yyeva/src/player/index.ts
index cf03313..89764bc 100644
--- a/packages/yyeva/src/player/index.ts
+++ b/packages/yyeva/src/player/index.ts
@@ -194,12 +194,12 @@ export default class EVideo {
this.isPlay = isPlay
}
}
- private isDestoryed() {
- logger.debug('player is destoryed!')
+ private isDestroyed() {
+ logger.debug('player is destroyed!')
}
public start() {
//::TODO 做播放兼容性处理
- if (!this.renderer) return this.isDestoryed()
+ if (!this.renderer) return this.isDestroyed()
this.startEvent()
}
@@ -291,7 +291,7 @@ export default class EVideo {
}
public stop() {
logger.debug('[player]stop.')
- if (!this.renderer) return this.isDestoryed()
+ if (!this.renderer) return this.isDestroyed()
if (this.renderer.isPlay === false) return
this.setPlay(false)
this.animator.stop()
@@ -536,7 +536,7 @@ export default class EVideo {
return URL.createObjectURL(blob)
}
public destroy() {
- if (!this.renderer) return this.isDestoryed()
+ if (!this.renderer) return this.isDestroyed()
this.revokeObjectURL('destroy')
logger.debug('[destroy]')
// this.stop()
diff --git a/packages/yyeva/src/player/render/index.ts b/packages/yyeva/src/player/render/index.ts
index eebdc12..819c02f 100644
--- a/packages/yyeva/src/player/render/index.ts
+++ b/packages/yyeva/src/player/render/index.ts
@@ -75,7 +75,7 @@ export default class WglRender {
public destroy() {
this.webgl.destroy()
this.videoEntity.destroy()
- this.renderCache.destory()
+ this.renderCache.destroy()
}
// public render(nextFPS: number) {
diff --git a/packages/yyeva/src/player/render/mCache.ts b/packages/yyeva/src/player/render/mCache.ts
index a9894b1..005ce33 100644
--- a/packages/yyeva/src/player/render/mCache.ts
+++ b/packages/yyeva/src/player/render/mCache.ts
@@ -174,8 +174,8 @@ export default class MCache {
this.checkCache()
this.setAnimationStatus()
}
- public destory() {
- logger.debug('[mCache]', '[destory]')
+ public destroy() {
+ logger.debug('[mCache]', '[destroy]')
this.removeCache()
this.checkCache()
}
diff --git a/packages/yyeva/src/player/render/renderCache.ts b/packages/yyeva/src/player/render/renderCache.ts
index bcf784a..a7c68f0 100644
--- a/packages/yyeva/src/player/render/renderCache.ts
+++ b/packages/yyeva/src/player/render/renderCache.ts
@@ -25,8 +25,8 @@ class RenderCache {
/**
* 注销缓存
*/
- public destory() {
- this.mCache.destory()
+ public destroy() {
+ this.mCache.destroy()
}
/**
* 申请缓存
diff --git a/packages/yyeva/src/player/render/videoEntity.ts b/packages/yyeva/src/player/render/videoEntity.ts
index ddcc95d..5387c33 100644
--- a/packages/yyeva/src/player/render/videoEntity.ts
+++ b/packages/yyeva/src/player/render/videoEntity.ts
@@ -1,4 +1,5 @@
import {logger} from 'src/helper/logger'
+import {isAndroid, isIOS} from 'src/helper/polyfill'
import {isDataUrl, isOffscreenCanvasSupported} from 'src/helper/utils'
import Animator from 'src/player/video/animator'
import {MixEvideoOptions, VideoAnimateType, VideoAnimateEffectType, VideoDataType, EScaleMode} from 'src/type/mix'
@@ -375,6 +376,23 @@ export default class VideoEntity {
return text
}
+ private defaultFontInfo(fontSize: number, ctx: ContextType) {
+ // console.log('font=', ctx.font)
+ if (isAndroid) {
+ let familyName = 'sans-serif'
+ const originFont = ctx.font.split(' ')
+ if (originFont && originFont.length) {
+ familyName = originFont[originFont.length - 1]
+ }
+
+ return ['normal', `${Math.round(fontSize)}px`, familyName]
+ } else if (isIOS) {
+ return ['normal', `${Math.round(fontSize)}px`, 'SFUI-Heavy']
+ } else {
+ return ['600', `${Math.round(fontSize)}px`, 'Microsoft YaHei']
+ }
+ }
+
/**
* 文字转换图片
* @param item
@@ -382,7 +400,7 @@ export default class VideoEntity {
private async makeTextImg(item: VideoAnimateEffectType, eOptions: any = {}, width = 0) {
if (!this.ctx) return
const ctx = this.ctx
- // console.log(`[makeTextImg] eOptions:`, eOptions)
+ console.log(`[makeTextImg] eOptions:`, eOptions)
if (eOptions.fontStyle) item.fontStyle = eOptions.fontStyle
if (eOptions.fontColor) item.fontColor = eOptions.fontColor
if (eOptions.fontSize) item.fontSize = eOptions.fontSize
@@ -413,7 +431,9 @@ export default class VideoEntity {
fontSize = Math.min((w / txtlength) * 1, defaultFontSize)
}
- const font = ['600', `${Math.round(fontSize)}px`, 'Microsoft YaHei']
+ const font = this.defaultFontInfo(fontSize, ctx)
+ // console.log('@@@@font=', font)
+ // const font = ['600', `${Math.round(fontSize)}px`, 'Microsoft YaHei']
if (fontStyle === 'b') {
font.unshift('bold')
}
diff --git a/projects/offical/src/preview/config/video.ts b/projects/offical/src/preview/config/video.ts
index 3dd23c6..58b4c55 100644
--- a/projects/offical/src/preview/config/video.ts
+++ b/projects/offical/src/preview/config/video.ts
@@ -1,3 +1,11 @@
+
+const queryString = window.location.search;
+console.log('[video]queryString=', queryString)
+const urlParams = new URLSearchParams(queryString)
+export const videoUrl = urlParams.get('videoUrl')
+
+console.log('[video]videoUrl=', videoUrl);
+
const host = ''
const selected: any = {
default: {
@@ -8,7 +16,7 @@ const selected: any = {
anchor_nick: 'boy',
anchor_avatar: '/yy/2.jpeg',
}, */
- videoUrl: `${host}/yy/pld_264_new.mp4`,
+ videoUrl: videoUrl || `${host}/yy/pld_264_new.mp4`,
effects: {
1: '/yy/b6.png',
2: '/yy/b6c.png',
diff --git a/projects/offical/src/preview/index.tsx b/projects/offical/src/preview/index.tsx
index 597bb45..a5e8079 100644
--- a/projects/offical/src/preview/index.tsx
+++ b/projects/offical/src/preview/index.tsx
@@ -2,11 +2,12 @@ import Layout from './Layout'
// import 'antd/dist/antd.min.css'
import './common.css'
import Jcx from './view/Jcx'
+import {videoUrl} from './config/video'
const Privew = () => (
<>
-
+ {!videoUrl && }
>
)
export default Privew