Skip to content

Commit 9025337

Browse files
authored
Add support for src attribute in VIDEO tag (daohoangson#848)
Related to daohoangson#802
1 parent 6e0ebe3 commit 9025337

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/fwfh_chewie/lib/src/internal/tag_video.dart

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ class TagVideo {
2828
onChild: onChild,
2929
onWidgets: onWidgets,
3030
);
31+
32+
final attrs = videoMeta.element.attributes;
33+
final url = wf.urlFull(attrs[kAttributeVideoSrc] ?? '');
34+
if (url != null) {
35+
_sourceUrls.add(url);
36+
}
3137
}
3238

3339
void onChild(BuildMetadata childMeta) {

packages/fwfh_chewie/test/chewie_factory_test.dart

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ void main() {
1010

1111
mockVideoPlayerPlatform();
1212

13-
testWidgets('renders video player', (tester) async {
13+
testWidgets('renders video player with src attribute', (tester) async {
14+
const html = '<video src="$src"></video>';
15+
final e = await explain(tester, html);
16+
expect(e, equals('[VideoPlayer:url=$src,aspectRatio=$defaultAspectRatio]'));
17+
});
18+
19+
testWidgets('renders video player with SOURCE child tag', (tester) async {
1420
const html = '<video><source src="$src"></video>';
1521
final e = await explain(tester, html);
1622
expect(e, equals('[VideoPlayer:url=$src,aspectRatio=$defaultAspectRatio]'));

0 commit comments

Comments
 (0)