How can we detect if publisher has stoped the stream

Ney

Member
In our iOS application we have two different controller. one controller is to publish the stream and second controller is to play the stream.

Here is the flow

User 1 is publishing the video through publishStream.
User 2 is playing the stream through playStream.

We need to show a pop up that publisher has stoped the stream.

Earlier I was checking this on subscriber side through the following code


Code:
- (void)changeStreamStatus:(FPWCSApi2Stream *)stream {
      switch ([stream getStatus]) {
              casekFPWCSStreamStatusFailed:
            {    if( !stream.isPublished)
{
// Method to show pop up
}
}
}
}

But Now I am facing another issue. The above case is also getting meet if user put the app in background during the live video and come back again.


Is there any way so that we can clearly define if video has been ended by publisher.
 
Last edited:

Ney

Member
Yes I am using the same but there are several cases when this method is getting called. This method is also getting called if subscriber goes background and come back with .
Code:
stream.isPublished = NO;
So is there any property or method through which we can be sure that streaming is not publishing any more ?
 

Max

Administrator
Staff member
Please clarify who switches application to background - publisher or subscriber? Are you trying both applications - for publishing and streaming - on the same iOS device simultaneously? Or, one application is used both for publishing and streaming?

This method is also getting called if subscriber goes background
The question here is why the subscriber's stream fails if the stream being played remains published and available. What is the failure reason: WCS_HOME/logs/flashphoner_manager.log, StreamStatusEvent with "status" "FAILED" - what is in "info"?
E.g., below stream failed because the session was disconnected
Code:
URL:http://localhost:9091/EchoApp/StreamStatusEvent
OBJECT:
{
  "nodeId" : "ah20GKYnbYKxjJmdh1zDs6cllWkn0Q0t@192.168.1.5",
  "appKey" : "defaultApp",
  "sessionId" : "/192.168.1.7:55870/192.168.1.5:8443",
  "mediaSessionId" : "eea716f0-fcfe-11e7-9d64-374f4626da83",
  "name" : "streamName1",
  "published" : true,
  "hasVideo" : true,
  "hasAudio" : true,
  "status" : "FAILED",
  "audioCodec" : "opus",
  "videoCodec" : "VP8",
  "info" : "Stopped by session disconnect",
  "record" : false,
  "width" : 320,
  "height" : 240,
  "bitrate" : 0,
  "quality" : 0,
  "createDate" : 1516355750380,
  "mediaProvider" : "WebRTC",
  "history" : false
}
method through which we can be sure that streaming is not publishing
Currently, there is no method to check if a stream published by other user is available.
 
Top