如何从网络套接字地址播放视频流,如: WS://somevideserver.net:8410 / 5b03a7aad01502281a39
我尝试使用WebSocketClient并成功连接到端口,但如何检索流并将其发送给播放器?
URI uri;
try {
uri = new URI(stremURL);
} catch (URISyntaxException e) {
e.printStackTrace();
return;
}
mWebSocketClient = new WebSocketClient(uri) {
@Override
public void onOpen(ServerHandshake serverHandshake) {
Log.d(TAG, "[getStreamURL] = "+"Opened");
// mWebSocketClient.send(“Hello from”+ Build.MANUFACTURER +“”+ Build.MODEL);
startStreaming();
}
@Override
public void onMessage(String s) {
final String message = s;
runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d(TAG, "[getStreamURL] message = "+message);
}
});
}
private void runOnUiThread(Runnable websocket) {
}
@Override
public void onClose(int i, String s, boolean b) {
Log.d(TAG, "[getStreamURL] = "+"Closed");
}
@Override
public void onError(Exception e) {
Log.d(TAG, "[getStreamURL] = "+"Error");
}
};
mWebSocketClient.connect();