3

I want mp4 artifact file to be played if I click it. enter image description here

However, when I click the mp4 artifact file, It looks like a picture below. It doesn't play enter image description here

If I download it and then I can play it in my local PC.

So I tried HTML5 embed feature to streaming this. I tried two codes below, but, they didn't work.

<video width="320" height="240" controls autoplay>
  <source src="monkey_result_19.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

and

<video width="320" height="240" controls autoplay>
  <source src="http://xx.xx.xx.xx:8080/view/MonkeyTest/job/test22/lastSuccessfulBuild/artifact/monkey_result_19.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>
John
  • 1,139
  • 3
  • 16
  • 33

2 Answers2

3

For an MP4 file located in our build artifacts I was able to enable the video by adding media-src 'self'; in addition to the default CSP options.

Testing the change

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; default-src 'none'; img-src 'self'; style-src 'self'; media-src 'self';")

To apply the change at startup

java -Dhudson.model.DirectoryBrowserSupport.CSP="sandbox; default-src 'none'; img-src 'self'; style-src 'self'; media-src 'self';" -jar jenkins.war

For more information about the Jenkins Content Security Policy, see the Jenkins Docs.

Chic
  • 9,836
  • 4
  • 33
  • 62
0

I solved this problem by removing security option. For example,

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "default-src 'self'; style-src 'self' 'unsafe-inline';")

You can refer to Jenkins Content Security Policy

John
  • 1,139
  • 3
  • 16
  • 33