Adsense Ad

Friday 12 May 2023

How to play a video file from a database table?

To play a video file from a database table, you need to store the video file as a BLOB (binary large object) in the table and use Webutil to access it from Oracle Forms. You also need to use the host built-in procedure to invoke a media player that can play the video file. Here is a possible code snippet that you can modify according to your needs:

declare
  v_blob blob;
  v_filename varchar2(100);
  v_player varchar2(100) := 'C:\\Program Files\\Windows Media Player\\wmplayer.exe';
begin
  select video into v_blob from tfile where id = :block.id; -- assuming you have a block with an id item
  v_filename := webutil_file_transfer.as_to_client_with_progress(v_blob,'video.mp4','Downloading video file...'); -- assuming the video file is mp4 format
  host(v_player || ' ' || v_filename); -- invoking the media player with the video file as argument
end;
This code queries the video column from the tfile table based on the id item in the current block1. Then it uses the webutil_file_transfer.as_to_client_with_progress function to transfer the BLOB to a temporary file on the client machine. Finally, it uses the host procedure to launch the Windows Media Player with the temporary file as an argument.

I hope this helps you. Please note that this code is not tested and may not work as expected. You may need to do some adjustments and configurations to make it work.