Skip to content

CCAudio.js a finished playback callback is needed #1837

@boqugames

Description

@boqugames

Add function codes to cc.Audio class

setFinishCallback: function (cb) {
    if (!this._element) return true;
    this._element.finishedCallback(cb);
},

and add function codes to cc.Audio.WebAudio.prototype

finishedCallback: function (cb) {
    var loop = this._loop;
    this._currentSource.onended = function() {
        if (!loop) {
            cb();
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions