LCOV - code coverage report
Current view: top level - entities - media_information.dart Coverage Total Hit
Test: lcov_cleaned.info Lines: 100.0 % 22 22
Test Date: 2025-06-20 10:50:47 Functions: - 0 0

            Line data    Source code
       1              : import 'package:flutter_chrome_cast/common/break.dart';
       2              : import 'package:flutter_chrome_cast/common/break_clips.dart';
       3              : import 'package:flutter_chrome_cast/common/hls_segment_format.dart';
       4              : import 'package:flutter_chrome_cast/common/hls_video_segment_format.dart';
       5              : import 'package:flutter_chrome_cast/common/text_track_style.dart';
       6              : import 'package:flutter_chrome_cast/entities/track.dart';
       7              : import 'package:flutter_chrome_cast/common/user_action_state.dart';
       8              : import 'package:flutter_chrome_cast/common/vast_ads_request.dart';
       9              : import 'package:flutter_chrome_cast/enums/stream_type.dart';
      10              : 
      11              : import 'media_metadata/cast_media_metadata.dart';
      12              : 
      13              : export 'package:flutter_chrome_cast/common/break.dart';
      14              : export 'package:flutter_chrome_cast/common/break_clips.dart';
      15              : export 'package:flutter_chrome_cast/common/hls_segment_format.dart';
      16              : export 'package:flutter_chrome_cast/common/hls_video_segment_format.dart';
      17              : export 'package:flutter_chrome_cast/common/text_track_style.dart';
      18              : export 'package:flutter_chrome_cast/entities/track.dart';
      19              : export 'package:flutter_chrome_cast/common/user_action_state.dart';
      20              : export 'package:flutter_chrome_cast/common/vast_ads_request.dart';
      21              : export 'package:flutter_chrome_cast/enums/stream_type.dart';
      22              : 
      23              : /// Holds all metadata and configuration for a media item, including content ID, type, metadata, breaks, tracks, and more.
      24              : class GoogleCastMediaInformation {
      25              :   /// Alternate entity to be used to load the media in Android TV app.
      26              :   /// If set, this will override the value set in entity if the
      27              :   /// receiver is an Android TV app. On the receiver side, the
      28              :   /// entity can be accessed from MediaInfo#getEntity().
      29              :   final String? atvEntity;
      30              : 
      31              :   /// Partial list of break clips that includes current break clip that receiver is playing or ones that receiver will play shortly after.
      32              :   /// This is to avoid overflow of MediaStatus message.
      33              :   final List<CastBreakClips>? breakClips;
      34              : 
      35              :   /// Service-specific identifier of the content currently loaded by the media player.
      36              :   /// This is a free form string and is specific
      37              :   /// to the application. In most cases, this will be the URL to the
      38              :   /// media, but the sender can choose to pass a string that the receiver can
      39              :   /// interpret properly. Max length: 1k
      40              :   final String contentId;
      41              : 
      42              :   /// Describes the type of media artifact as one of the following:
      43              : 
      44              :   /// NONE
      45              :   /// BUFFERED
      46              :   /// LIVE
      47              :   final CastMediaStreamType streamType;
      48              : 
      49              :   /// MIME content type of the media being played.
      50              :   final String contentType;
      51              : 
      52              :   /// The media metadata object, one of the following:
      53              : 
      54              :   /// 0  GenericMediaMetadata
      55              :   /// 1  MovieMediaMetadata
      56              :   /// 2  TvShowMediaMetadata
      57              :   /// 3  MusicTrackMediaMetadata
      58              :   /// 4  PhotoMediaMetadata
      59              :   final GoogleCastMediaMetadata? metadata;
      60              : 
      61              :   /// Optional duration of the currently playing stream in seconds.
      62              :   final Duration? duration;
      63              : 
      64              :   /// Optional application-specific blob of data defined by either the sender application or the receiver application
      65              :   final Map<String, dynamic>? customData;
      66              : 
      67              :   /// List of breaks.
      68              :   final List<CastBreak>? breaks;
      69              : 
      70              :   /// Optional media URL, to allow using contentId for real ID.
      71              :   /// If contentUrl is provided, it will be used
      72              :   /// as media URL, otherwise the contentId will
      73              :   /// be used as the media URL.
      74              :   final Uri? contentUrl;
      75              : 
      76              :   /// Optional media entity, commonly a Google Assistant deep link.
      77              : 
      78              :   final String? entity;
      79              : 
      80              :   /// The format of the HLS audio segment.
      81              :   final CastHlsSegmentFormat? hlsSegmentFormat;
      82              : 
      83              :   /// The format of the HLS video segment.
      84              :   final HlsVideoSegmentFormat? hlsVideoSegmentFormat;
      85              : 
      86              :   /// Provides absolute time (Epoch Unix time in seconds)
      87              :   /// for live streams. For live event it
      88              :   /// would be the time the event started,
      89              :   /// otherwise it will be start of the
      90              :   /// seekable range when the streaming started.
      91              : 
      92              :   final DateTime? startAbsoluteTime;
      93              : 
      94              :   /// The requested text track style. If not provided,
      95              :   /// the device style preferences (if existing) will be used.
      96              : 
      97              :   final TextTrackStyle? textTrackStyle;
      98              : 
      99              :   /// Array of Track objects.
     100              :   final List<GoogleCastMediaTrack>? tracks;
     101              : 
     102              :   /// Indicates the user action state for media.
     103              :   /// Indicate user like, dislike, or
     104              :   /// follow actions for the media.
     105              : 
     106              :   final List<UserActionState>? userActionStates;
     107              : 
     108              :   /// VMAP ad request configuration. Used if breaks and breakClips are not provided.
     109              : 
     110              :   final VastAdsRequest? vmapAdsRequest;
     111              : 
     112              :   /// Creates a new [GoogleCastMediaInformation] instance.
     113            2 :   GoogleCastMediaInformation({
     114              :     this.atvEntity,
     115              :     this.breakClips,
     116              :     required this.contentId,
     117              :     required this.streamType,
     118              :     required this.contentType,
     119              :     this.metadata,
     120              :     this.duration,
     121              :     this.customData,
     122              :     this.breaks,
     123              :     this.contentUrl,
     124              :     this.entity,
     125              :     this.hlsSegmentFormat,
     126              :     this.hlsVideoSegmentFormat,
     127              :     this.startAbsoluteTime,
     128              :     this.textTrackStyle,
     129              :     this.tracks,
     130              :     this.userActionStates,
     131              :     this.vmapAdsRequest,
     132              :   });
     133              : 
     134              :   /// Converts the object to a map for serialization.
     135            2 :   Map<String, dynamic> toMap() {
     136            2 :     return {
     137            2 :       'atvEntity': atvEntity,
     138            2 :       'breakClips': breakClips?.map((x) => x.toMap()).toList(),
     139            2 :       'contentID': contentId,
     140            4 :       'streamType': streamType.value,
     141            2 :       'contentType': contentType,
     142            2 :       'metadata': metadata?.toMap(),
     143            2 :       'duration': duration?.inSeconds,
     144            2 :       'customData': customData,
     145            2 :       'breaks': breaks?.map((x) => x.toMap()).toList(),
     146            3 :       'contentURL': contentUrl?.toString(),
     147            2 :       'entity': entity,
     148            2 :       'hlsSegmentFormat': hlsSegmentFormat?.name,
     149            2 :       'hlsVideoSegmentFormat': hlsVideoSegmentFormat?.name,
     150            2 :       'startAbsoluteTime': startAbsoluteTime?.millisecondsSinceEpoch,
     151            2 :       'textTrackStyle': textTrackStyle?.toMap(),
     152            2 :       'tracks': tracks?.map((x) => x.toMap()).toList(),
     153            2 :       'userActionStates': userActionStates?.map((x) => x.toMap()).toList(),
     154            2 :       'vmapAdsRequest': vmapAdsRequest?.toMap(),
     155            4 :     }..removeWhere((key, value) => value == null);
     156              :   }
     157              : }
        

Generated by: LCOV version 2.3.1-1