Hi
I'm sorry to write this question.
I 'm developing the watchOS audio streaming application.
I'm using AVPlayer and URLSessionWebSocketTask.
the process like this.
var request = URLRequest(url: socketURL)
request.networkServiceType = .avStreaming
URLSession(configuration: .default, delegate: self, delegateQueue: nil).webSocketTask(with: request)
2. add receiver to URLSessionWebSocketTask.
3. send parameter through URLSessionWebSocketTask and receive track's CDN url without any connection error.
4. After receiving the CND's url, activate the AVAudioSession and just play it with AVPlayer.
5. when the 'AVPlayerItemDidPlayToEndTime' notification called, send URLSessionWebSocketTask with next playItem's parameter and waiting for receive CND's url.
But the problem is here.
The connection is disconnected. and I received error.
The log is here.
THE ERROR: Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected" UserInfo={NSErrorFailingURLKey=wss://test.com, NSErrorFailingURLStringKey=wss://test.com}
I think when the AVAudioSession activated,
I can send and receive anything through URLWebSocket.
But it is not true.
Could you tell me where the problem is? please...
thanks.
I'm sorry to write this question.
I 'm developing the watchOS audio streaming application.
I'm using AVPlayer and URLSessionWebSocketTask.
the process like this.
create the webSocket like this:
var request = URLRequest(url: socketURL)
request.networkServiceType = .avStreaming
URLSession(configuration: .default, delegate: self, delegateQueue: nil).webSocketTask(with: request)
2. add receiver to URLSessionWebSocketTask.
3. send parameter through URLSessionWebSocketTask and receive track's CDN url without any connection error.
4. After receiving the CND's url, activate the AVAudioSession and just play it with AVPlayer.
5. when the 'AVPlayerItemDidPlayToEndTime' notification called, send URLSessionWebSocketTask with next playItem's parameter and waiting for receive CND's url.
But the problem is here.
The connection is disconnected. and I received error.
The log is here.
THE ERROR: Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected" UserInfo={NSErrorFailingURLKey=wss://test.com, NSErrorFailingURLStringKey=wss://test.com}
I think when the AVAudioSession activated,
I can send and receive anything through URLWebSocket.
But it is not true.
Could you tell me where the problem is? please...
thanks.