【问题标题】:Nativescript audio plugin errorNativescript 音频插件错误
【发布时间】:2017-09-11 18:27:09
【问题描述】:

我正在测试 nativescript-audio 插件,但无法使其适用于 vanilla js。 这是我的代码……

var ns_audio = require("nativescript-audio");

var player = new ns_audio.TNSPlayer();

var playerOptions = {
        audioFile: "http://www.noiseaddicts.com/samples_1w72b820/2514.mp3",
        loop: false,
        completeCallback: function () {
            console.log('completePlayer')
        },
        errorCallback: function (errorObject) {
            console.log(JSON.stringify(errorObject));
        },
        infoCallback: function (args) {
            console.log(JSON.stringify(args));
        }
    };

player.playFromUrl(playerOptions)
        .then(function (res) {
            console.log(res);
        })
        .catch(function () {
            console.log("didn't work...");
        })

我收到以下错误:

JS ERROR TypeError: null is not an object (evaluating '_this._player.delegate = _this')

我做错了什么? 谢谢!

【问题讨论】:

    标签: javascript nativescript


    【解决方案1】:

    好的,上面的代码是正确的,可能错误是由于错误的插件构建...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-25
      • 2020-03-13
      • 1970-01-01
      • 2012-05-16
      • 2017-12-31
      相关资源
      最近更新 更多