LCOV - code coverage report
Current view: top level - _session_manager - cast_session_manager_platform.dart Coverage Total Hit
Test: lcov_cleaned.info Lines: 0.0 % 1 0
Test Date: 2025-06-20 10:50:47 Functions: - 0 0

            Line data    Source code
       1              : import 'package:flutter_chrome_cast/entities/cast_session.dart';
       2              : import 'package:flutter_chrome_cast/entities/cast_device.dart';
       3              : import 'package:flutter_chrome_cast/enums/connection_state.dart';
       4              : import 'package:plugin_platform_interface/plugin_platform_interface.dart';
       5              : 
       6              : /// <p>A class that manages sessions. </p>
       7              : /// <p>The method <a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_session_manager#a211d476c2e9b265ed7510d12f4b29c02">startSessionWithDevice: (GCKSessionManager)</a> is used to create a new session with a given <a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_device" data-title="An object representing a receiver device. ">GCKDevice</a>. The session manager uses the <a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_device_provider" data-title="An abstract base class for performing device discovery and session construction. ">GCKDeviceProvider</a> for that device type to construct a new <a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_session" data-title="An abstract base class representing a session with a receiver device. ">GCKSession</a> object, to which it then delegates all session requests.</p>
       8              : /// <p><a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_session_manager" data-title="A class that manages sessions. ">GCKSessionManager</a> handles the automatic resumption of suspended sessions (that is, resuming sessions that were ended when the application went to the background, or in the event that the application crashed or was forcibly terminated by the user). When the application resumes or restarts, the session manager will wait for a short time for the device provider of the suspended session's device to discover that device again, and if it does, it will attempt to reconnect to that device and re-establish the session automatically.</p>
       9              : /// <p>If the application has created a <a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button" data-title="A subclass of UIButton that implements a &quot;Cast&quot; button. ">GCKUICastButton</a> without providing a target and selector, then a user tap on the button will display the default Cast dialog and it will automatically start and stop sessions based on user selection or disconnection of a device. If however the application is providing its own device selection/control dialog UI, then it should use the <a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_session_manager" data-title="A class that manages sessions. ">GCKSessionManager</a> directly to create and control sessions.</p>
      10              : /// <p>Whether or not the application uses the <a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_session_manager" data-title="A class that manages sessions. ">GCKSessionManager</a> to control sessions, it can attach a <a class="el notranslate" href="/cast/docs/reference/ios/protocol_g_c_k_session_manager_listener-p" data-title="The GCKSessionManager listener protocol. ">GCKSessionManagerListener</a> to be notified of session events, and can also use KVO to monitor the <a class="el notranslate" href="/cast/docs/reference/ios/interface_g_c_k_session_manager#a8b48906a8910f328343e2260e6bef6a0" data-title="The current session connection state. ">connectionState</a> property to track the current session lifecycle state.</p>
      11              : /// <dl class="section since"><dt>Since</dt><dd>3.0 </dd></dl>
      12              : 
      13              : abstract class GoogleCastSessionManagerPlatformInterface
      14              :     extends PlatformInterface {
      15              :   /// Creates a new [GoogleCastSessionManagerPlatformInterface].
      16            0 :   GoogleCastSessionManagerPlatformInterface({required super.token});
      17              : 
      18              :   /// Tests if a session is currently being managed by this session manager, and it is currently connected.
      19              : 
      20              :   /// This will be YES if the session state is ConnectionStateConnected.
      21              :   bool get hasConnectedSession;
      22              : 
      23              :   /// The current session, if any.
      24              :   GoogleCastSession? get currentSession;
      25              : 
      26              :   /// Stream of current session changes.
      27              :   Stream<GoogleCastSession?> get currentSessionStream;
      28              : 
      29              :   ///   readnonatomicassign
      30              : 
      31              :   /// The current session connection state.
      32              : 
      33              :   GoogleCastConnectState get connectionState;
      34              : 
      35              :   /// Starts a new session with the given device, using the default session options that were registered for the device category, if any.
      36              : 
      37              :   /// This is an asynchronous operation.
      38              : 
      39              :   /// Parameters
      40              :   ///     device        The device to use for this session.
      41              : 
      42              :   /// Returns
      43              :   ///     YES if the operation has been started successfully, NO if there is a session currently established or if the operation could not be started.
      44              :   Future<bool> startSessionWithDevice(GoogleCastDevice device);
      45              : 
      46              :   /// Attempts to join or start a session with options that were supplied to the UIApplicationDelegate::application:openURL:options: method.
      47              : 
      48              :   /// Typically this is a request to join an existing Cast session on a particular device that was initiated by another app.
      49              : 
      50              :   /// Parameters
      51              :   ///     openURLOptions        The options that were extracted from the URL.
      52              : // /    sessionOptions  The options for this session, if any. May be nil.
      53              : 
      54              : // Returns
      55              : //     YES if the operation has been started successfully, NO if there is a session currently established, or the openURL options do not contain the required Cast options.
      56              : 
      57              : // Since
      58              : //     4.0
      59              : 
      60              :   Future<bool> startSessionWithOpenURLOptions();
      61              : 
      62              :   /// Suspends the current session.
      63              : 
      64              :   /// This is an asynchronous operation.
      65              : 
      66              :   /// Parameters
      67              :   ///
      68              :   ///     reason        The reason for the suspension.
      69              : 
      70              :   /// Returns
      71              :   ///     YES if the operation has been started successfully, NO if there is no session currently established or if the operation could not be started.
      72              : 
      73              :   Future<bool> suspendSessionWithReason();
      74              : 
      75              :   ///Ends the current session.
      76              : 
      77              :   /// This is an asynchronous operation.
      78              : 
      79              :   /// Returns
      80              :   ///     YES if the operation has been started successfully, NO if there is no session currently established or if the operation could not be started.
      81              : 
      82              :   Future<bool> endSession();
      83              : 
      84              :   /// Ends the current session and stops casting if one sender device is connected; otherwise, optionally stops casting if multiple sender devices are connected.
      85              : 
      86              :   /// Use the stopCasting parameter to indicate whether casting on the receiver should stop when the session ends. This parameter only applies when multiple sender devices are connected. For example, the same app is open on multiple sender devices and each sender device has an active Cast session with the same receiver device.
      87              : 
      88              :   ///     If you set stopCasting to YES, the receiver app stops casting when multiple devices are connected.
      89              :   ///     If stopCasting is NO and other devices have an active session, the receiver keeps playing.
      90              :   ///     If only one sender device is connected, the receiver app stops casting the media and ignores the stopCasting value, even if it's set to NO.
      91              : 
      92              :   /// Parameters
      93              :   ///     stopCasting   Whether casting on the receiver should stop when the session ends. Only used when multiple sender devices are connected.
      94              : 
      95              :   /// Returns
      96              :   ///     YES if the operation to end the session started successfully, NO if there is no session currently established or if the operation could not be started.
      97              : 
      98              :   Future<bool> endSessionAndStopCasting();
      99              : 
     100              :   /// Sets the default session options for devices in a specific category (iOS only).
     101              :   ///
     102              :   /// This method is only available on iOS platforms and works with GCKSessionOptions.
     103              :   /// Use this to configure default session behavior for specific device categories.
     104              :   ///
     105              :   /// Implementation note:
     106              :   /// For native iOS, this maps to:
     107              :   /// - sessionOptions: nullable GCKSessionOptions
     108              :   /// - forDeviceCategory: (NSString *) category
     109              :   Future<void> setDefaultSessionOptions(
     110              :       // nullable GCKSessionOptions *\tsessionOptions
     111              :       // forDeviceCategory: \t\t(NSString *)  \tcategory
     112              :       );
     113              : 
     114              :   /// Sets the device volume.
     115              :   void setDeviceVolume(double value);
     116              : }
        

Generated by: LCOV version 2.3.1-1