@@ -119,7 +119,22 @@ abstract class VideoPlayerPlatform {
119119 void _verifyProvidesDefaultImplementations () {}
120120}
121121
122+ /// Description of the data source used to create an instance of
123+ /// the video player.
122124class DataSource {
125+ /// Constructs an instance of [DataSource] .
126+ ///
127+ /// The [sourceType] is always required.
128+ ///
129+ /// The [uri] argument takes the form of `'https://example.com/video.mp4'` or
130+ /// `'file://${file.path}'` .
131+ ///
132+ /// The [formatHint] argument can be null.
133+ ///
134+ /// The [asset] argument takes the form of `'assets/video.mp4'` .
135+ ///
136+ /// The [package] argument must be non-null when the asset comes from a
137+ /// package and null otherwise.
123138 DataSource ({
124139 @required this .sourceType,
125140 this .uri,
@@ -128,16 +143,34 @@ class DataSource {
128143 this .package,
129144 });
130145
146+ /// The way in which the video was originally loaded.
147+ ///
148+ /// This has nothing to do with the video's file type. It's just the place
149+ /// from which the video is fetched from.
131150 final DataSourceType sourceType;
151+
152+ /// The URI to the video file.
153+ ///
154+ /// This will be in different formats depending on the [DataSourceType] of
155+ /// the original video.
132156 final String uri;
157+
158+ /// **Android only**. Will override the platform's generic file format
159+ /// detection with whatever is set here.
133160 final VideoFormat formatHint;
161+
162+ /// The name of the asset. Only set for [DataSourceType.asset] videos.
134163 final String asset;
164+
165+ /// The package that the asset was loaded from. Only set for
166+ /// [DataSourceType.asset] videos.
135167 final String package;
136168}
137169
138- /// The way in which the video was originally loaded. This has nothing to do
139- /// with the video's file type. It's just the place from which the video is
140- /// fetched from.
170+ /// The way in which the video was originally loaded.
171+ ///
172+ /// This has nothing to do with the video's file type. It's just the place
173+ /// from which the video is fetched from.
141174enum DataSourceType {
142175 /// The video was included in the app's asset files.
143176 asset,
@@ -164,17 +197,37 @@ enum VideoFormat {
164197 other
165198}
166199
200+ /// Event emitted from the platform implementation.
167201class VideoEvent {
202+ /// Creates an instance of [VideoEvent] .
203+ ///
204+ /// The [eventType] argument is required.
205+ ///
206+ /// Depending on the [eventType] , the [duration] , [size] and [buffered]
207+ /// arguments can be null.
168208 VideoEvent ({
169209 @required this .eventType,
170210 this .duration,
171211 this .size,
172212 this .buffered,
173213 });
174214
215+ /// The type of the event.
175216 final VideoEventType eventType;
217+
218+ /// Duration of the video.
219+ ///
220+ /// Only used if [eventType] is [VideoEventType.initialized] .
176221 final Duration duration;
222+
223+ /// Size of the video.
224+ ///
225+ /// Only used if [eventType] is [VideoEventType.initialized] .
177226 final Size size;
227+
228+ /// Buffered parts of the video.
229+ ///
230+ /// Only used if [eventType] is [VideoEventType.bufferingUpdate] .
178231 final List <DurationRange > buffered;
179232
180233 @override
@@ -196,12 +249,27 @@ class VideoEvent {
196249 buffered.hashCode;
197250}
198251
252+ /// Type of the event.
253+ ///
254+ /// Emitted by the platform implementation when the video is initialized or
255+ /// completed or to communicate buffering events.
199256enum VideoEventType {
257+ /// The video has been initialized.
200258 initialized,
259+
260+ /// The playback has ended.
201261 completed,
262+
263+ /// Updated information on the buffering state.
202264 bufferingUpdate,
265+
266+ /// The video started to buffer.
203267 bufferingStart,
268+
269+ /// The video stopped to buffer.
204270 bufferingEnd,
271+
272+ /// An unknown event has been received.
205273 unknown,
206274}
207275
0 commit comments