URL for local mp4

I am working on creating a WEB Core / Miletus app. The app will be downloading mp4 files. The mp4 files will be stored locally so the app can play them "offline".

The app uses the TWebMultimediaPlayer component. The mp4 file is stored in a video folder under the root folder (the folder where the .exe is stored). When the javascript app tries to load the file via the URL property ( URL := "video/videoName.mp4", the browser console reports a 404 error. Should this work?
If not, is there a way that this can be done?

Hi,

Both in WEB Core and Miletus you are working on a web application that is hosted by a browser in one way or another. The browser can not (and should not) access files on your system on its own, that would be a huge security risk.

With TWebMultimediaPlayer normally you can use a base64 data url. In Miletus we've provided access to local files via the TMiletusBinaryDataStream class, which gives you an option to get a file in base64 format.

Putting the two together:

procedure TForm1.WebButton1Click(Sender: TObject);
var
  bs: TMiletusBinaryDataStream;
begin
  bs := TMiletusBinaryDataStream.Create;
  bs.LoadFromFileAsync(YOUR_PATH, procedure
  begin
    //Assign the base64 in the form of a base64 data url by 
    //adding the necessary
    WebMultimediaPlayer1.URL := 'data:video/mp4;base64,' + bs.Base64;
    bs.Free;
  end);
end;

Thank you