I want to save in a table from my database an .avi file using c# and Oracle 11g.
The table is a simple one
CREATE TABLE VIDEOS
(
id number,
description varchar2(20),
video ORDSYS.OrdVideo
);
The thing I am doing is using a form in c# get some fields and call a procedure from the Oracle db
The procedure is
create or replace
procedure inserareVideoBD(vid in number, vdescriere in varchar2, nfis in varchar2 )
is
begin
declare
obj ORDSYS.ORDVideo;
ctx RAW (64):=NULL;
begin
insert into videos values (vid, vdescriere, ordsys.ordvideo.init('FILE', 'DIR', nfis));
commit;
end;
end;
// to mention that the DIR file was already assigned and the db has access to it because the images that I save almost the same way work
So after the video is saved I want to retrieve it using this procedure
create or replace
procedure FETCHERVIDEO (vid in number, flux out blob, descriere out varchar2)
is
begin
declare
obj ordsys.ordvideo;
mimeType VARCHAR2(4000);
format VARCHAR2(31);
ctx RAW(64) :=NULL;
begin
select video into obj from videos where id=vid;
DBMS_LOB.CREATETEMPORARY(flux, true, 10);
obj.getContentInLob(ctx,flux, mimeType,format);
select description into descriere from videos where id=vid;
end;
end;
After the video is saved I want to play it using windows media player. This is the code that want's to accomplish that
OracleCommand cmd1 = new OracleCommand("fetchervideo", con);
cmd1.CommandType = CommandType.StoredProcedure;
cmd1.Parameters.Add("vid", OracleDbType.Int32);
cmd1.Parameters.Add("flux", OracleDbType.Blob);
cmd1.Parameters.Add("descriere", OracleDbType.Varchar2, 255);
cmd1.Parameters[0].Direction = ParameterDirection.Input;
cmd1.Parameters[1].Direction = ParameterDirection.Output;
cmd1.Parameters[2].Direction = ParameterDirection.Output;
//get video id
cmd1.Parameters[0].Value = Convert.ToInt32(comboBox1.SelectedItem);
try { cmd1.ExecuteScalar(); }
catch (OracleException exc) { Mesaj2.Text = "Mesaj: " + exc.Message; }
OracleBlob var = (OracleBlob)cmd1.Parameters[1].Value;
byte[] blob = new Byte[var.Length];
File.WriteAllBytes(@"c://temp_mvi.avi", blob);
try
{
player.URL = "c://temp_mvi.avi";
player.Ctlcontrols.play();
}
The problem is that the file is saved at the specified path but it can't be played while the original file that was uploaded was playing on the same player.
Am I missing something can anybody give some better idea. Every response is highly appreciated!
如果您使用的是Web应用程序,我认为您需要在html端指定内容类型,以便它可以相应地显示内容。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.