Git Product home page Git Product logo

Comments (2)

yiwen03 avatar yiwen03 commented on August 24, 2024

from h265player.

fzw2408 avatar fzw2408 commented on August 24, 2024

config.js 中的这个吗?
const BUFFER = {
//单位秒
maxDuration: 30,
maxSize: 1024 * 1000 * 1000,
maxRetryCount: 3
}
HLSLoader.js中这两个没有相应的控制代码。之定义了一下。
maxBufferDuration = BUFFER.maxDuration
maxBufferSize = BUFFER.maxSize

提个修改建议 :如果有更好的解决思路据更好了。

Element.js中
static adaptSizeElement(width, height, $container, $element) {
const $box = $container
const $canvas = $element
$canvas.width = width || $canvas.width || $box.offsetWidth
$canvas.height = height || $canvas.height || $box.offsetHeight
const canvasWidth = $canvas.width
const canvasHeight = $canvas.height
let proportion = 0
$canvas.style.position = 'absolute'

if ($box.offsetWidth <= 0) {
  $box.style.width =  canvasWidth + 'px'
}
if ($box.offsetHeight <= 0) {
  $box.style.height = canvasHeight + 'px'
}

const widthProportion = $box.offsetWidth / canvasWidth
const heightProportion = $box.offsetHeight / canvasHeight

if (heightProportion > widthProportion) {
  proportion = widthProportion
} else {
  proportion = heightProportion
}
$canvas.style.top = $box.offsetTop + (($box.offsetHeight - canvasHeight * proportion) / 2)  + 'px'
****$canvas.style.left = 0+'px'//$box.offsetLeft + (($box.offsetWidth - canvasWidth * proportion) / 2)  + 'px'
//$canvas.style.transform = `scale(${proportion }, ${proportion }) //页面发生伸缩的时候定位会错位。 我的做法直接铺满screen_canve
$canvas.style.transform = `scale(${widthProportion}, ${heightProportion})`****
$canvas.style['transform-origin'] = `top left`;
$canvas.style.display = 'inline-block'

}
}

from h265player.

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.