Giter VIP home page Giter VIP logo

Comments (6)

toxic-johann avatar toxic-johann commented on May 20, 2024

关于宽高的设置。

相关历史理解

早期的设计**,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.

skyline0705 avatar skyline0705 commented on May 20, 2024

我觉得这里直接通过单一对象的方式其实不太利于后期扩展。
如果按照目前的设计**, 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.

toxic-johann avatar toxic-johann commented on May 20, 2024

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.

songguangyu avatar songguangyu commented on May 20, 2024

wrapper 其实可以用户自己来设置。
chimee 需要关注的是container 和 video。 是否应该 container 和 video 默认是100% 也就是和wrapper保持一致,然后提供一个对象集合来专门设置css样式。就像楼上写的那样。

from chimee.

toxic-johann avatar toxic-johann commented on May 20, 2024

Hmmm.如果大家觉得 js hardcode container 和 wrapper 的 css 是可以接受的话。个人觉得还是可以尝试一下这种操作。

from chimee.

toxic-johann avatar toxic-johann commented on May 20, 2024

已在 0.5.0 修复

from chimee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.