Interface Broadcaster.Observer

  • Enclosing class:
    Broadcaster

    public static interface Broadcaster.Observer
    An Observer interface that must be implemented for you to receive callbacks about important state changes and events within the Broadcaster. All callbacks are done on the main UI thread.
    • Method Detail

      • onConnectionStatusChange

        void onConnectionStatusChange​(BroadcastStatus status)
      • onStreamHealthUpdate

        void onStreamHealthUpdate​(int health)
        Will be called regularly while capturing. The stream health is a measure of how much of the produced video and audio data that can be sent in real-time over the network. When automatic resolution switching is enabled, the Broadcaster will switch between resolutions automatically to produce less data, keeping the stream health value high.
        Parameters:
        health - The current stream health percent, 0 to 100.
      • onConnectionError

        void onConnectionError​(ConnectionError type,
                               String message)
        This callback will be called for any kind of connection error.
        Parameters:
        type - A constant that identifies the error type.
        message - An optional error-message from the streaming server, null for most error types.
      • onCameraError

        void onCameraError​(CameraError error)
      • onChatMessage

        void onChatMessage​(String message)
        Will be called on incoming messages from the backend to the broadcaster. See the ExampleChatController class used in the bundled example broadcaster for an example UI for incoming messages.
        Parameters:
        message - The incoming message.
      • onResolutionsScanned

        void onResolutionsScanned()
        This callback will be called every time a camera is starting and updated lists of supported resolutions are available via Broadcaster.getSupportedResolutions() and Broadcaster.getSupportedPictureResolutions().

        Camera preview and capture will not start before this callback returns. We recommend that you use Broadcaster.getSupportedResolutions() and setResolution(width, height) to choose the desired camera resolution, which sets an upper limit for the broadcast resolution.

        If you switch between cameras and don't do anything in this callback, the starting camera will use the same resolution as the previous camera. If the same resolution is not supported, the camera will select the closest lower supported resolution. To step up to a higher resolution when switching cameras you need to invoke setResolution(width, height).

      • onCameraPreviewStateChanged

        void onCameraPreviewStateChanged()
        Called whenever a camera has stopped or started. This is a suitable time to call hasFocus(), hasZoom() and hasTorch() and enable/disable corresponding buttons in the UI.
      • onBroadcastInfoAvailable

        void onBroadcastInfoAvailable​(String vid,
                                      String url)
        Called when a broadcast has been added to the Bambuser database. This callback is deprecated and will be removed in a future release.
        Parameters:
        vid - Internal video id. This value is no longer used. See onBroadcastIdAvailable(String) instead.
        url - Legacy url. This value is no longer used. See the Bambuser documentation on resourceUris instead.
      • onBroadcastIdAvailable

        void onBroadcastIdAvailable​(String broadcastId)
        Called when a broadcast has been added to the Bambuser database. Provides a broadcast id, used when communicating with certain backend API endpoints.
        Parameters:
        broadcastId - Unique id for this broadcast.