I have a simple method below that tries to play a conventional Video component. When trying to load a video using an ExternalResource (the videos come from either Youtube or an external link of another website) in a Window component, the window result behaves differently. For example, in Edge browsers, the video will simply will not load but with the play / pause controls are visible. In Firefox, the loading cursor keeps running forever. (note that HtmlContentAllowed flag is turned on)
protected void loadVideoWindow(String url){
Window subWindow = new Window();
subWindow.setSizeFull();
subWindow.setModal(true);
subWindow.setResizable(false);
Video video = new Video("Video",new ExternalResource("https://youtu.be/xxxx")); //url string will be used here
video.setWidth("600px");
video.setHeight("600px");
video.setHtmlContentAllowed(true);
subWindow.setContent(video);
UI.getCurrent().addWindow(subWindow);
}
If there's indeed a known problem without a workaround of running external videos using that method above, is it better to move to loading another tab / url link and play the video instead?
I also noticed that there are two known addons: SWF and the AudioVideo addon. The former seems to be very old, while for the latter, can the ExternalResource be used or it needs to be converted to a ClassResource first (as seen in the example)?