I am looking for an opportunity to play a file located on a remote server, while making it possible to buffer this video file. It's not a problem to reproduce it, but I haven't learned how to manage buffering.
Initial data for playing link type: http://somesite.com/video_file.mp4
- MediaElement WPF
- ActiveX vlc plugin – there are no flexible buffering settings
- libVLC.dll – unfortunately, the VLC library cannot be correctly pulled into the project, there are no Russian-language manuals at all, and the English versions constantly swear that the library simply does not have the necessary functions.
With the help of what exactly can the idea be realized?
There are libraries:
There are paid libraries that support online playback in WPF:
- http://www.visioforge.com/video-capture-sdk-net2.html or http://www.visioforge.com/media-player-sdk-net.html
I also found this code for directshownet:
var fGraph = new FilterGraph() as IFilterGraph2; var cGraph = new CaptureGraphBuilder2() as ICaptureGraphBuilder2; cGraph.SetFiltergraph(fGraph); IBaseFilter sourceFilter = null; hr = fGraph.AddSourceFilter(@"http://localhost:8080/tempStreaming.asf", "SourceFilter", out sourceFilter);//ВОТ ЭТА СТРОКА DsError.ThrowExceptionForHR(hr); var vRender = new VideoRenderer() as IBaseFilter; var aRender = new AudioRender() as IBaseFilter; hr = fGraph.AddFilter(vRender, "vRenderer"); DsError.ThrowExceptionForHR(hr); hr = cGraph.RenderStream(null, MediaType.Video, sourceFilter, null, vRender); DsError.ThrowExceptionForHR(hr); hr = fGraph.AddFilter(aRender, "aRenderer"); DsError.ThrowExceptionForHR(hr); hr = cGraph.RenderStream(null, MediaType.Audio, sourceFilter, null, aRender); DsError.ThrowExceptionForHR(hr); var mcx = fGraph as IMediaControl; hr = mcx.Run(); DsError.ThrowExceptionForHR(hr);
Taken from: https://stackoverflow.com/a/7487900/4423545
As a separate option: you can stupidly embed a browser into the app, put the video player code into it, and inside it, open a file from the Internet 🙂 It's a strange move, but it will work 🙂