File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -59,26 +59,26 @@ Widget defaultEmbedBuilderWeb(
59
59
),
60
60
);
61
61
case BlockEmbed .videoType:
62
- final youtubeID = YoutubePlayer . convertUrlToId ( node.value.data) ;
63
- var embedUrl = node.value.data;
64
-
65
- if (youtubeID != null ) {
66
- embedUrl =
67
- 'https://www.youtube.com/embed/${ YoutubePlayer . convertUrlToId ( embedUrl )}' ;
62
+ var videoUrl = node.value.data;
63
+ if (videoUrl. contains ( 'youtube.com' ) || videoUrl. contains ( 'youtu.be' )) {
64
+ final youtubeID = YoutubePlayer . convertUrlToId (videoUrl);
65
+ if (youtubeID != null ) {
66
+ videoUrl = 'https://www.youtube.com/embed/$ youtubeID ' ;
67
+ }
68
68
}
69
69
70
70
UniversalUI ().platformViewRegistry.registerViewFactory (
71
- embedUrl ,
71
+ videoUrl ,
72
72
(id) => html.IFrameElement ()
73
73
..width = MediaQuery .of (context).size.width.toString ()
74
74
..height = MediaQuery .of (context).size.height.toString ()
75
- ..src = embedUrl
75
+ ..src = videoUrl
76
76
..style.border = 'none' );
77
77
78
78
return SizedBox (
79
79
height: 500 ,
80
80
child: HtmlElementView (
81
- viewType: embedUrl ,
81
+ viewType: videoUrl ,
82
82
),
83
83
);
84
84
default :
You can’t perform that action at this time.
0 commit comments