2017-09-11 4 views
0

nativescript-audioプラグインをテストしていますが、vanilla jsで動作させることはできません。ここ は私のコードは...Nativescript audio plugin error

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') 

私が間違っているのか? ありがとう!

答えて

0

上記のコードは正しいです。おそらく、間違ったプラグインのビルドによるものです...

関連する問題