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.
but host procedure cannot be used to invoke client files?
Sent message. but host procedure cannot be used to invoke client files
You are right, the host procedure can only invoke executables on the application server, not on the client machine. To invoke executables on the client machine, you need to use thewebutil_host.hostprocedure instead. Here is how you can modify the code:
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
webutil_host.host(v_player || ' ' || v_filename); -- invoking the media player on the client machine with the video file as argument
end;
This code uses thewebutil_host.hostprocedure instead of the host procedure to launch the Windows Media Player on the client machine. You need to make sure that you have configured Webutil properly and granted the necessary privileges to use this procedure.