Comments (6)
关于宽高的设置。
相关历史理解
早期的设计**,wrapper 为外层容器,container 为内层容器,video 为原生容器。三者之间不一定等价。例如 wrapper 中可以嵌入播放列表,container 包括控件等**。
在插件层其实可以直接访问到相关 wrapper, video, container 节点。对于插件开发者也有$css 可以调整 css 的相关样式。
不过以上方面对于 chimee 层的使用者均不提供。这里大家可以讨论下开放出去有没有利弊。
关于 width 和 height 的意义
早期的设置是将所有 video 的 attribute 开放出来,所以这个 width 和 height 确实只是针对 video,在理解上的确有歧义。我们曾经讨论过关于 css 的设置。当时得出的结果是希望用户去理解 container 和 wrapper 这种设计。
但是我们也可以看到,这给用户带来各种开箱后用不了的问题。此时,我们可以思考是否有必要改进这个 api。
思考解决方案有,width 和 height 智能化。
当用户只传入一个值时,我们考虑为宏观值,给 container 设置。
当用户传入一个 对象,形如
{
videoWidth: 10,
containerWidth: 10,
wrapperWidth: 10,
}
我们才分别设置。
不过这个思考有不周到之处。
设置 width 和 height 其余的坑点
还有一个十分重要的场景是关于全屏。如果用户设置后会有什么问题,会不会阻碍用户顺利全屏呢。大家可以探讨下。
@huzunjie @songguangyu @332065255 @yandeqiang
from chimee.
我觉得这里直接通过单一对象的方式其实不太利于后期扩展。
如果按照目前的设计**, wrapper, video, container三者可以分开设置相关的config,比如:
const config = {
video: {
width: 800,
height: 450
},
wrapper: {
width: 900,
height: 450
},
container: {
width: 800,
height: 450
}
}
这样拆分起来比起
{
videoWidth: 10,
containerWidth: 10,
wrapperWidth: 10
}
这种方式个人觉得会清晰一些,并且可以删除掉现有的width与height设置,只需要对使用者普及一下wrapper, video, container的概念即可
from chimee.
hmm。但现阶段 chimee 绝大部分的设置确实只存在在 video 上。而且如果分拆等于多加了一层。不过的确是可以提供 container、video 和 wrapper 作为子对象管理。这里面的设置相当于 css 或者其余我们日常用的设置。
形如:
{
// video 上的 attribute
width: 100,
height: 90,
// video 上的 css
video: {
width: '100px'
height: '90px'
},
wrapper: {
width: 900,
height: 450
},
container: {
width: 800,
height: 450
},
}
不过这确实增加了很多学习成本。但是从实现上来说这样是行之有效的。而且我们官方也可以相当于通过默认配置提供较好的 css 默认设置。
from chimee.
wrapper 其实可以用户自己来设置。
chimee 需要关注的是container 和 video。 是否应该 container 和 video 默认是100% 也就是和wrapper保持一致,然后提供一个对象集合来专门设置css样式。就像楼上写的那样。
from chimee.
Hmmm.如果大家觉得 js hardcode container 和 wrapper 的 css 是可以接受的话。个人觉得还是可以尝试一下这种操作。
from chimee.
已在 0.5.0 修复
from chimee.
Related Issues (20)
- An in-range update of core-js is breaking the build 🚨 HOT 1
- 视频全屏后支持竖屏还是横屏播放么 HOT 2
- An in-range update of @types/lodash is breaking the build 🚨 HOT 5
- expect that this plugin can be used in vue3/vue2 HOT 1
- Configuration x5VideoPlayerType should use 'h5-page' instead of 'h5' HOT 3
- import chimee 报错 Error: Can't resolve 'core-js/es7/global'
- 可以增加一些 react hooks 的 demo吗
- 播放器的延时会比较严重
- npm i 之后 npm start报错 无法查看效果 HOT 1
- 请问这个开源项目还有在维护吗?
- 播放不m3u8和rtmp的直播源是怎么回事
- 播放不m3u8和rtmp的直播源是怎么回事??
- pc端播放不嘞m3u8和rtmp的直播源是怎么回事???
- 能否加下支持H265视频格式
- http-flv数据正常请求却无法正常播放
- 打包之后报错:TypeError: Zn is not a function
- 请问如何支持mpeg4编码格式
- Yudz
- Uuhh
- Chimee 实例销毁无法再重建播放
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chimee.