V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
xiaoyanbot
V2EX  ›  问与答

小程序音频播放接口, 我想播放 第 20 秒 到 第 22 秒 的内容,如何实现?

  •  
  •   xiaoyanbot · Mar 9, 2018 · 1906 views
    This topic created in 2981 days ago, the information mentioned may be changed or developed.

    https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-audio.html#wxcreateaudiocontextaudioid

    看到从第 20 秒开始播放可以做到, 但第 22 秒停止怎么弄?

    5 replies    2018-03-09 13:55:16 +08:00
    xiaoyanbot
        1
    xiaoyanbot  
    OP
       Mar 9, 2018
    自己计时不可靠吧?
    Chemist
        2
    Chemist  
       Mar 9, 2018 via iPhone
    难道你指望每播一秒的音频给你执行一次回调吗。
    ragnaroks
        3
    ragnaroks  
       Mar 9, 2018
    https://mp.weixin.qq.com/debug/wxadoc/dev/api/createInnerAudioContext.html

    currentTime(Number)
    当前音频的播放位置(单位:s ),只有在当前有合法的 src 时返回,时间不取整,保留小数点后 6 位
    MinonHeart
        4
    MinonHeart  
       Mar 9, 2018 via iPad
    用新版接口
    learnshare
        5
    learnshare  
       Mar 9, 2018
    我记得之前的 js-sdk 相当不可靠
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6004 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 03:25 · PVG 11:25 · LAX 20:25 · JFK 23:25
    ♥ Do have faith in what you're doing.