喜马拉雅 - 有声读书 播放器分析

in 默认分类 with 0 comment

音频地址规律分析

音频地址分析

获取音频地址分析

代码分析

  1. 点击【下一首】并找到对应的处理handler

    key: "render",
    value: function() {
    return o.default.createElement("div", {
    className: "".concat(u.default, "-btns fl")
    }, o.default.createElement("a", {
    href: "javascript:;",
    className: "prev",
    onClick: this.handlePrev
    }, o.default.createElement(a.default, {
    icon: "icon-quanjubofangqi-shangyiqu",
    width: 10,
    height: 10
    })), this.renderPlayOrPauseBtn(), o.default.createElement("a", {
    href: "javascript:;",
    className: "next",
    onClick: this.handleNext
    }, o.default.createElement(a.default, {
    icon: "icon-quanjubofangqi-xiayiqu",
    width: 10,
    height: 10
    })))
    }
  2. 继续跟踪到next方法处,找到applyPluginsAsyncWaterfall可以看到触发了异步事件 player@nextTrack

    key: "next",
    value: function() {
    var t = this;
    this.applyPluginsAsyncWaterfall("player@nextTrack", {
    playMode: this.playMode,
    currentTrackId: this.currentTrack.trackId
    }, function(e, n) {
    return e ? "拉取下一页声音数据" : t.switchTrack("next").then(function(e) {
        return t._play()
    })
    })
    }

稍后待续...

Responses