Answer the question
In order to leave comments, you need to log in
Spring Boot + Html5 video. How to show videos that are located in a different system directory?
Good afternoon! There is a web application on Spring Boot. There is a catalog with films, which is located in a separate directory. Import of titles of films realized and I save in a DB. When showing a movie, via the html video tag, there is no access to the video. Error in console: “Not allowed to load local resource: file:///C:…”.
How can this problem be solved?
Answer the question
In order to leave comments, you need to log in
Well, usually such files are in a special direct. media. In short, your web server is configured incorrectly. That is, you need to add your directory to the web server path.
Configuration:
@Configuration
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/video/**").addResourceLocations("/path/to/video");
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question