Stream MP4 Video From Seek Position in ASP.NET

戏子无情 提交于 2019-12-04 21:44:59

After googled, there are no related APIs found.

You might check the workaround if the problem can't be fixed.

If possible, please provide more information for further study.

Agreed, you cannot just seek an mp4/m3u8 file like that.

But I think you cannot find the solution or workaround for this, we have senior iPhone developers and external consultant in my iPhone development team for trial and error, we spend so many resources but the problem still cannot fix.

There is no valid content type definition. Try by setting ContentType as video/mp4.

UPDATE

While content type is defined and according to your code the http status code is 206, I suggest you to check this page: 206 Partial Content

Dylan - INNO Software

Muhammad,

I notice you are doing a lot of calculating and manipulation of the content headers. Perhaps when you do all the math on those it is resulting in a header that is not valid because of extra decimal places (making it invalid) or some other issue with those settings.

Meaning, I suggest you do the following:

  1. Run a sample video with streaming from a site using the same player, etc. then use a tool to view the headers while it's working successfully. Just to have a baseline set of headers and valid value formats to compare against.

  2. Run your application and track the headers after you've set them, perhaps like so: how to dump response headers in ASP.Net Even better, install 'Live HTTP Headers' FireFox plug-in or something along those lines.

Compare the working set of headers to yours. Do you see something odd in the values you are setting? Is it possible the content range/length/etc. is somehow offset or invalid? Just look for consistency, a small mistake could easily break the entire request.

Maybe I'm missing something here, but I hope that sparks some ideas.

I don't think you can just seek an mp4 file like that. Even if you have the headers you'll need to seek to an I-frame for the video to be playable. You're very likely using the wrong APIs for this.

I won't comment on the response-stuff in this post but one issue you definitely have is the MP4 parsing. Unlike MP3 you cannot easily convert a time offset into a byte range like this. You'll need to parse the mp4 moov element and lookup the right chunk in the relevant tracks based on the time offset you're interested in. It goes like this: moov->trak->mdia->minf->stbl->stts The stts box will give you the sample to time mapping you need.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!