public void PopulateVideoPreview(HttpContext context, long fileId) { try { context.Response.Clear(); FileLibrary lib = new FileLibrary(); VideoFileLibrary videoLib = new VideoFileLibrary(); AWAPI_Data.Data.awFile file = lib.Get(fileId); string extension = FileLibrary.GetFileExension(file.path); if (file == null || !videoLib.isVideoFile(extension)) { return; } if (!file.isOnLocal) { context.Response.Redirect(file.thumbnail); return; } if (!System.IO.File.Exists(file.thumbnail)) { return; } context.Response.ContentType = "image/jpeg"; context.Response.AddHeader("Content-Disposition", "inline; filename=" + file.title + "_preview.jpg"); byte[] bytes = File.ReadAllBytes(file.thumbnail); context.Response.OutputStream.Write(bytes, 0, bytes.Length); } catch (Exception ex) { throw ex; } }
void PopulateFile(long fileId) { ResetControls(); AWAPI_Data.Data.awFile file = _fileLib.Get(fileId); if (file == null) { return; } _fileId.Text = file.fileId.ToString(); _fileTitle.Text = file.title; _fileDescription.Text = file.description; _fileIsEnabled.Checked = file.isEnabled; System.Text.StringBuilder uploadInfo = new System.Text.StringBuilder(); if (file.awUser_File != null) { uploadInfo.Append("<br/>Uploaded by :<b>" + file.awUser_File.firstName + " " + file.awUser_File.lastName + "</b>"); } uploadInfo.Append("<br/><b>" + file.createDate.ToString() + "</b>"); uploadInfo.Append("<br/>ContetType: <b>" + file.contentType + "</b>"); uploadInfo.Append("<br/>Size: <b>" + file.contentSize / 1024 + "KB</b>"); _fileUploadInfo.Text = uploadInfo.ToString(); if (file.contentType.IndexOf("image") >= 0) { _fileImg.Visible = true; _fileImg.ImageUrl = AWAPI_BusinessLibrary.library.FileLibrary.GetUrl(fileId, file.path, "150x150"); } string fileUrl = ""; if (file.path != null) { if (!file.isOnLocal || file.path.IndexOf("http://") >= 0) { fileUrl = file.path; } else { fileUrl = AWAPI_BusinessLibrary.library.ConfigurationLibrary.Config.fileServiceUrl + "?id=" + fileId; } _fileLink.NavigateUrl = fileUrl; _fileLink.Visible = true; if (file.contentType == "video/x-flv") { string previewUrl = AWAPI_BusinessLibrary.library.ConfigurationLibrary.Config.fileServiceUrl + "?id=" + fileId + "&method=getvideopreview"; _filePreview.Text = "<object type='application/x-shockwave-flash' data='includes/swf/player_flv_maxi.swf' width='400' height='300'>" + "<param name='movie' value='includes/swf/player_flv_maxi.swf' />\n" + "<param name='allowFullScreen' value='true' />\n" + "<param name='FlashVars' value='startimage=" + Server.UrlEncode(previewUrl) + "&width=400&height=300&showstop=1&showvolume=1&showtime=1&showfullscreen=1&bgcolor1=189ca8&bgcolor2=0E82CB&playercolor=0E82CB&flv=" + fileUrl + "' />" + "</object>"; } //flv=/medias/KyodaiNoGilga.flv&width=320&height=240&showstop=1&showvolume=1&showtime=1&startimage=/medias/startimage_en.jpg&showfullscreen=1&bgcolor1=189ca8&bgcolor2=085c68&playercolor=085c68 } _shareIt.Visible = true; _shareIt.Link = _fileLink.NavigateUrl; // App_Code.Misc.GetUrlOnly() + "?fileid=" + file.fileId.ToString(); PopulateSelectedGroups(fileId); ShowHideControl(btnDeleteFile_, true); ShowHideControl(lblDeleteFile_, true); }