Skip to content

Stream availability checking by name

Since build 1.1.0.28 it is possible to check if a stream with a given name is available on a server for playback, like WebSDK function Stream.available().

To check, do the following:

  1. Create a separate Stream object with the stream name to check availability
    code

    StreamOptions streamOptions = new StreamOptions(mPlayStreamView.getText().toString());
    Stream stream = session.createStream(streamOptions);
    

  2. Create a callback function to receive the stream availability flag and a possible error reason phrase
    code

    stream.setAvailableStreamCallback(new AvailableStreamCallback() {
      @Override
      public void on(boolean isAvailable,  String info) {
          runOnUiThread(new Runnable() {
              @Override
              public void run() {
                  mAvailableStreamStatusView.setText(String.valueOf(isAvailable));
                  mAvailableStreamInfoView.setText(info);
              }
          });
      }
    });
    

  3. Call Stream.available() method
    code

    stream.availableStream();