文章目录
- 随着百度小程序的风头正劲,越来越多的站长投入到百度小程序的开发中来,但是开发过程中难免会碰到诸多问题无法自己解决,03-30小编发现百度用户:【Amy135】提出了一个关于“视频转GIF,希望视频能在画布中画出来,微信的例子能实现,拿到百度上报错”的问题,在问题中开发者Amy135对该问题做了如下阐述:
- 问题类型:需求
- onReady: function () { const that = this wx.createSelectorQuery() .select(‘#myVideo’) .context() .exec((res) => { console.log(‘res:’, res) const videoCtx = res[0].context videoCtx.play(); wx.createSelectorQuery() .select(‘#canvas’) .node() .exec((res) => { console.log(‘res:’, res) const canvas = res[0].node const ctx = canvas.getContext(‘2d’) ctx.fillRect(0, 0, 100, 100) let img = [] let start; canvas.requestAnimationFrame(function loop(timestamp) { ctx.drawImage(videoCtx, 0, 0) if (start === undefined) start = timestamp; const elapsed = timestamp – start; if (elapsed < 2000) { canvas.requestAnimationFrame(loop) } else { const gif = canvas.toDataURL() that.setData({ gif: gif }) //that.showGIF(); } }) }) }) }, 注:以上是百度小程序开发者:”Amy135″对于本问题的一些阐述,这里做一个引用,我们将实时关注百度小程序助手对该问题提出的解决方案。
- 【03-30】百度官方对用户Amy135提出的视频转GIF,希望视频能在画布中画出来,微信的例子能实现,拿到百度上报错给予如下回复 链接地址提交不上去,只能截图了
- 不同于腾讯和阿里封闭式的小程序体系,百度智能小程序走的是开放路线。截止目前,他们已经陆续开放了50万行智能小程序代码。这意味着其他平台的小程序只需简单修改几行代码,就可以迁入智能小程序,实现一次开发多端可运行。 如果您也在使用百度小程序,请关注我们,如果您有关于百度小程序的使用问题请联系我们,或者去百度小程序平台找官方人员给予解决,相信百度在小程序上的发力会是一个里程碑!
随着百度小程序的风头正劲,越来越多的站长投入到百度小程序的开发中来,但是开发过程中难免会碰到诸多问题无法自己解决,03-30小编发现百度用户:【Amy135】提出了一个关于“视频转GIF,希望视频能在画布中画出来,微信的例子能实现,拿到百度上报错”的问题,在问题中开发者Amy135对该问题做了如下阐述:
- 问题类型:需求
onReady: function () { const that = this wx.createSelectorQuery() .select(‘#myVideo’) .context() .exec((res) => { console.log(‘res:’, res) const videoCtx = res[0].context videoCtx.play(); wx.createSelectorQuery() .select(‘#canvas’) .node() .exec((res) => { console.log(‘res:’, res) const canvas = res[0].node const ctx = canvas.getContext(‘2d’) ctx.fillRect(0, 0, 100, 100) let img = [] let start; canvas.requestAnimationFrame(function loop(timestamp) { ctx.drawImage(videoCtx, 0, 0) if (start === undefined) start = timestamp; const elapsed = timestamp – start; if (elapsed < 2000) { canvas.requestAnimationFrame(loop) } else { const gif = canvas.toDataURL() that.setData({ gif: gif }) //that.showGIF(); } }) }) }) },
onReady: function () { const that = this wx.createSelectorQuery() .select(‘#myVideo’) .context() .exec((res) => { console.log(‘res:’, res) const videoCtx = res[0].context videoCtx.play(); wx.createSelectorQuery() .select(‘#canvas’) .node() .exec((res) => { console.log(‘res:’, res) const canvas = res[0].node const ctx = canvas.getContext(‘2d’) ctx.fillRect(0, 0, 100, 100) let img = [] let start; canvas.requestAnimationFrame(function loop(timestamp) { ctx.drawImage(videoCtx, 0, 0) if (start === undefined) start = timestamp; const elapsed = timestamp – start; if (elapsed < 2000) { canvas.requestAnimationFrame(loop) } else { const gif = canvas.toDataURL() that.setData({ gif: gif }) //that.showGIF(); } }) }) }) },
注:以上是百度小程序开发者:”Amy135″对于本问题的一些阐述,这里做一个引用,我们将实时关注百度小程序助手对该问题提出的解决方案。
【03-30】百度官方对用户Amy135提出的视频转GIF,希望视频能在画布中画出来,微信的例子能实现,拿到百度上报错给予如下回复
链接地址提交不上去,只能截图了
不同于腾讯和阿里封闭式的小程序体系,百度智能小程序走的是开放路线。截止目前,他们已经陆续开放了50万行智能小程序代码。这意味着其他平台的小程序只需简单修改几行代码,就可以迁入智能小程序,实现一次开发多端可运行。
如果您也在使用百度小程序,请关注我们,如果您有关于百度小程序的使用问题请联系我们,或者去百度小程序平台找官方人员给予解决,相信百度在小程序上的发力会是一个里程碑!