TNSPlayer PlayFromUrl错误:错误域= NSURLErrorDomain代码= -999“已取消”

时间:2019-02-04 02:24:20

标签: nativescript

我以前使用的本机脚本音频播放器不再起作用。我们的音频流不再播放,错误回调将播放器称为“未定义”,并且我们收到了这个漫长的错误消息。

  

控制台日志文件:///app/home/home-view-model.js:166:28:错误消息:   错误域= NSURLErrorDomain代码= -999“已取消”   UserInfo = {NSErrorFailingURLStringKey = http://46.28.53.118:7095/live,   NSLocalizedDescription =已取消,   NSErrorFailingURLKey = http://46.28.53.118:7095/live}

我无法从TNSPlayer获取完整的控制台输出,因此我看不到它到底是怎么做的。如果您不能帮助我解决此错误,至少可以帮助我获取完整的打印输出

此更改完全是我无法控制的。我没有进行任何更改,突然TNSPlayer停止工作。

this.player = new TNSPlayer();

this.player.playFromUrl({
         audioFile: station.streamURL,
         loop: false,
         completeCallback: (args: any) => {
            console.log('complete callback,' args);
            console.log(args);
         },
         errorCallback: (args: any) => {
            console.log("reference back to player:", args.player);
            console.log('error message: ', args.error);
            console.log(args.extra); // Android only.
)}.then(() => {
         console.log('Audio now streaming.', this.player.isAudioPlaying());
         that.setBusy(false, page);
         that.player.volume = that.muted ? 0 : that.volume;
         that.currentlyPlaying = true;

         if (that.pendingArtwork == null) {
            const placeholderImg = applicationSettings.getString('theme', 'default') == 'blue' ? 'blue' : 'default';
            that.set('trackArtwork', `~/images/missing-${placeholderImg}.png`);
            let pendingStationName = that.currentStationName;
            setTimeout(() => {
               if (pendingStationName == that.currentStationName && that.pendingArtwork == null) {
                  that.set('trackArtwork', `~/images/stationArtwork/${shortCode}.png`);
               }
            }, 3000);
         } else {
            that.set('trackArtwork', that.pendingArtwork);
         }
         console.log('this player is playing, and its name is ', this.player);
         clearInterval(that.loadingDots);
         that.set('trackText', that.pendingTitle);
});

它应该只是开始播放与URL关联的流。相反,整个事情失败了。

0 个答案:

没有答案