Video markup doesn't display content in Dartium

Issue

I currently have a problem in Dartium.

If I create a new web project in dart editor and I put a video on the default html page that is created like this :

<video width="640" height="480" controls>
  <source src="sample-video.mp4" type="video/mp4">    
</video>

The video isn’t displayed in dartium when I run the project.

Obviously, the “sample-video.mp4” file exists in the filesystem and it can be played in another tab thanks to the vlc player plugin.

The video is also read properly when I try to display the file in Chrome, so, my mp4 codec seems OK for the browser.

Is someone have an idea ?

Thanks.

Seb.

Solution

I think .mp4 is not supported natively. I had a similar problem yesterday. Try to convert your MP4 file into webm and ogg (to support all browsers).

You can then use

VideoElement e = new VideoElement();
print("canPlay: " + e.canPlayType('video/mp4'));
print("canPlay: " + e.canPlayType('video/webm'));
print("canPlay: " + e.canPlayType('video/ogg'));

which gives me:

canPlay:
canPlay: maybe
canPlay: maybe

to detect what formats are supported. MP4 is not supported.

Answered By – Robert

Answer Checked By – Jay B. (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *