Reputation: 715
I have a movie in my sitecore media library. The path is: mywebsite/~/media/movies/movie.mp4 When I enter this URL, the browser is trying to save file on my computer. What can I do to display this movie in browser, when enter this URL? I tried to remove Content-Disposition header but this header is still added to response
I found this element:
<mediaType name="Any" extensions="*">
<mimeType>application/octet-stream</mimeType>
<forceDownload>true</forceDownload>
<sharedTemplate>system/media/unversioned/file</sharedTemplate>
<versionedTemplate>system/media/versioned/file</versionedTemplate>
<metaDataFormatter type="Sitecore.Resources.Media.MediaMetaDataFormatter" />
<mediaValidator type="Sitecore.Resources.Media.MediaValidator" />
<thumbnails>
<generator type="Sitecore.Resources.Media.MediaThumbnailGenerator, Sitecore.Kernel">
<extension>png</extension>
<filePath>/sitecore/shell/themes/standard/images/document_music.png</filePath>
</generator>
<width>150</width>
<height>150</height>
<backgroundColor>#FFFFFF</backgroundColor>
</thumbnails>
<prototypes>
<media type="Sitecore.Resources.Media.Media, Sitecore.Kernel" />
<mediaData type="Sitecore.Resources.Media.MediaData, Sitecore.Kernel" />
</prototypes>
</mediaType>
When I change forceDownload to false, it's ok, but I want it only for movie files.
Upvotes: 1
Views: 1768
Reputation: 1396
You probably need to change the media library setting for MP4 files. Add this to a patch config file:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<mediaLibrary>
<mediaTypes>
<mediaType name="Movie file" extensions="mp4">
<mimeType>video/mp4</mimeType>
<forceDownload>false</forceDownload>
</mediaType>
</mediaTypes>
<mediaLibrary>
</sitecore>
</configuration>
You might have to set the mimeType (put that in a <mimeType>
element) as well.
Upvotes: 1