pjproject
pjproject copied to clipboard
[Question] Swift IOS Video stream's window id is always PJSUA_INVALID_ID.
Hello, sorry for posting question here. I asked a same question in stackoverflow and no response. So I just wanted to ask from people who know.
I'm newbie for PJSIP and I wanted to implement PJSIP on IOS device. I downloaded latest release version 2.11.1 and compiled for iphone and successfully connected incomming and outcoming calls. But my video stream's window id is always PJSUA_INVALID_ID a.k.a -1. Here is my sample swift code:
//on init() function
acc_cfg.vid_in_auto_show = pj_true
acc_cfg.vid_out_auto_transmit = pj_true
acc_cfg.vid_cap_dev = PJMEDIA_VID_DEFAULT_CAPTURE_DEV.rawValue
acc_cfg.vid_rend_dev = PJMEDIA_VID_DEFAULT_RENDER_DEV.rawValue
var orient = PJMEDIA_ORIENT_ROTATE_90DEG;
pjsua_vid_dev_set_setting(
PJMEDIA_VID_DEFAULT_CAPTURE_DEV.rawValue,
PJMEDIA_VID_DEV_CAP_ORIENTATION,
&orient,
pj_true
)
// Add account
pjsua_acc_add(&acc_cfg, pj_true, nil);
// media state callback
// I tried same thing in my on_incoming_call function and also same...
private func on_call_media_state(call_id: pjsua_call_id) {
var call_info = pjsua_call_info();
guard pjsua_call_get_info(call_id, &call_info) == PJ_SUCCESS.rawValue else {return}
let video_index = pjsua_call_get_vid_stream_idx(call_id)
let medias: [pjsua_call_media_info] = tupleToArray(tuple: call_info.media);
if video_index >= 0 {
let media = medias[Int(video_index)]
let window_id = media.stream.vid.win_in
if window_id == PJSUA_INVALID_ID.rawValue {
print("Invalid Window id...")
}
}
}
Btw I use SRTP. In my guess maybe I need to configure some codecs or view attached to some ViewController or do I need to allow some permission in my info.plist?
I have the same problem, when I make a video call from the Wave Lite App, the connected Media status is always PJMEDIA_TYPE_AUDIO, and the window_id is also Invalid
I'm sorry. I'm gonna close this issue. My above code was perfectly fine. It was working. Problem was in my server's STRP wasn't configured correctly.