0

I got my routing here:

get "/fortytwo" do
  send_file("42.mp4")
end

And my HTML for the page that shall play the video is as follows:

<body>
    <video controls autoplay>
        <source src="fortytwo" type="video/mp4">
    </video>
</body>

But when loading the page, a disabled video player shows up that won't play any media. Linking to a copy of the video that was uploaded to Dropbox with "dl=1" works perfectly fine.

Sessho
  • 177
  • 8

1 Answers1

0

The code you posted is working fine, so the problem must be somewhere else than in Sinatra. Maybe a CORS problem, where is your HTML file located? It should be on the same domain where Sinatra is running.

I remade the whole program (below) and it's working:

require 'sinatra'

get "/fortytwo" do
  send_file("42.mp4")
end

get "/" do
  page = <<-endfile
  <body>
  <video controls autoplay>
  <source src="fortytwo" type="video/mp4">
  </video>
  </body>
  endfile
end
Community
  • 1
  • 1
Esa Mäkinen
  • 160
  • 8