小编Ken*_*Ken的帖子

iOS 如何使用 nativescript-audio 插件播放网络广播流?

我正在nativescript开发一个网络广播应用程序和 nativescript-audio插件来读取流。在 Android 上我没有问题,但在iOS方法上:

sharedSession.dataTaskWithUrlCompletionHandler(URL, function(data, response, error)) 返回错误 = {}

这是我的Info.plist 的一部分

<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
	    <key>radioking.com</key>
		<dict>
    		<key>NSIncludesSubdomains</key>
	    	<true/>
		    <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
			<true/>
    		<key>NSTemporaryExceptionMinimumTLSVersion</key>
	    	<string>TLSv1.1</string>
		</dict>
    </dict>
</dict>
Run Code Online (Sandbox Code Playgroud)

这是我的网址:https : //www.radioking.com/play/jobradio 流格式为 mp3

插件调用:

private player  = new TNSPlayer();

public initFromUrl(url : string, autoPlay : boolean = false) {
    // Initialize player
    this.player.initFromUrl({
        audioFile: url,
        loop: false,
        completeCallback: () => {
            this.player.dispose().then(() => { });
        },
        errorCallback: args => { }, …
Run Code Online (Sandbox Code Playgroud)

ios nativescript

2
推荐指数
1
解决办法
846
查看次数

标签 统计

ios ×1

nativescript ×1