![]() = MediaTypeHeaderValue.Parse(fileDetails. HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK) HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.PartialContent)Ĭontent = new ByteRangeStreamContent(stream,, MediaTypeHeaderValue.Parse(fileDetails.MimeType)) Var stream = new FileStream(/* FILE NAME - convert id to file somehow */, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) StartByte = Convert.ToInt32(range.From ? 0) Public HttpResponseMessage Video(string id) You get the chance to decide the security you want to apply etc in code. Open the Application tool, then Service Workers. Or, press Ctrl + Shift + I (Windows, Linux) or Command + Option + I (macOS). Here is an implementation of responding to Range requests correctly - it reads a video from a file and returns it to the browser as a stream, so it doesnt eat up your server's ram. To confirm that your service worker is running: In Microsoft Edge, go to To open DevTools, right-click the webpage, and then select Inspect. I don't know how to solve this issue in Google Chrome Browser When I try to do this, video goes back to the beggining.īut in Firefox and Edge it's working like it should be, I can go back to already played part. and finally after writing to output stream decrementing it to total size of file.Īfter I load page video start to play immediately, but I can not seek for previous (already played) seconds of video or rewind it as well in Google Chrome browser. here we are writing the readed buffer to output//Īwait outputStream.WriteAsync(buffer, 0, sizeOfReadedBuffer) Int sizeOfReadedBuffer = fileStream.Read(buffer, 0, count) here we are reading the buffer from orginal file ![]() Int count = totalSize > bufferSize ? bufferSize : totalSize _("Content-Range", "bytes 0-"+ totalSize.ToString()+"/"+ fileStream.Length) *here we are saying read bytes from file as long as total size of file Progressive Downloader is a utility that enables you to easily and quickly fetch. Using (var fileStream = ().GridRecordFiles.GetFileAsStream(_fileName)) Zoom Downloader for Mac is not available on the developers website. here we re using stream to read file from db server Public async void WriteContentToStream(Stream outputStream, HttpContent content, TransportContext transportContext) In order to implement progressive downloading I'm using PushStreamContent in server response httpResponce.Content = new PushStreamContent((Action)new StreamService(fileName,httpResponce).WriteContentToStream) I'm trying to play in Chrome Browser video with source from Web Api
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |