Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/406.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
合并javascript回调、soundmanager2和waveform.js_Javascript_This_Soundmanager2 - Fatal编程技术网

合并javascript回调、soundmanager2和waveform.js

合并javascript回调、soundmanager2和waveform.js,javascript,this,soundmanager2,Javascript,This,Soundmanager2,我正在尝试使用soundmanager2、soundcloud流和waveform.js()构建一个音频播放器。播放机本身正在工作,但要让waveform.js的回调与我自己的回调(更新时间等)一起运行要困难得多 waveform.js提供了一个方法,该方法返回一个对象,该对象包含soundmanager2的whileplaying和whileloading对象的回调。我可以将其合并,但这显然会删除我自己的回调 我尝试过直接调用waveform.js回调函数 whileplaying: func

我正在尝试使用soundmanager2、soundcloud流和waveform.js()构建一个音频播放器。播放机本身正在工作,但要让waveform.js的回调与我自己的回调(更新时间等)一起运行要困难得多

waveform.js提供了一个方法,该方法返回一个对象,该对象包含soundmanager2的whileplaying和whileloading对象的回调。我可以将其合并,但这显然会删除我自己的回调

我尝试过直接调用waveform.js回调函数

whileplaying: function(){
    waveformObj.optionsForSyncedStream().whileplaying;
    updateTime();
}
但这会产生一些错误

画布:尝试将strokeStyle或fillStyle设置为既不是字符串、CanvasGradient也不是CanvasPattern的值时被忽略。 this.context.fillStyle=this.innerColor

在waveform.js方法中生成

我猜这与解决这个问题有关,所以我尝试使用了。apply,但没有用

任何关于这项工作的建议都将不胜感激

更新

创建soundmanager对象时,它会使用许多选项,其中一些是回调选项,如下所示

var opts = {
            id: _this.o.latestTrackId,
            url: _this.o.latestStream,
            autoLoad: true,
            autoPlay: autoPlay,
            multiShot: false,
            onplay: function(){
                _this.playing = true;
                _this.o.playButton.addClass('playing');
                _this.o.playButton.removeClass('paused');
                },
            onpause: function(){
                _this.playing = false;
                _this.o.playButton.removeClass('playing');
                _this.o.playButton.addClass('paused');
                },
            onresume: function(){
                _this.playing = true;
                _this.o.playButton.addClass('playing');
                _this.o.playButton.removeClass('paused');
                },
            onfinish: function(){
                },
            onstop: function(){
                },
            onload: function(){
                },
            whileloading: function(){
                _this.updateLoading();
                },
            whileplaying: function(){
                _this.setElapsed();
                _this.updatePlayhead();
                },
            stream: true,
            volume: 90
        };
我想包含waveform.js中的函数来更新波形,提供了一个返回

whileplaying: function(),
whileloading: function()

除了我自己的setExpressed()之外,我还想包括这些第二次whileplaying/whileloading等,但是直接调用它们会导致上面的警告。

需要更多上下文,我们可以查看您的代码吗?我不确定合并回调的
意味着什么…我更新了我的问题,尝试给出更多的上下文,希望这能解释问题,谢谢你的帮助。