visioforge / .Net-SDK-s-samples

VisioForge .Net SDKs samples - Video Capture SDK, Video Edit SDK, Media Player SDK, Media Blocks SDK, Video Fingerprinting SDK
https://www.visioforge.com
MIT License
51 stars 26 forks source link

HTTPSourceBlock have issues under MAUI+Windows 11? #25

Closed suyana closed 2 months ago

suyana commented 2 months ago

I use Example:

VisioForge. MediaBlocks.Demos.CS.MAUI.net8/SimplePlayerMB8

Replace the UniversalSourceBlock of the code with var tmpSource = new HTTPSourceBlock(new HTTPSourceSettings(new Uri(" http://test.visioforge.com/video.mp4 ")));

Running programs on the Windows platform, unable to play videos properly

Player_OnError prompts the following error:

[MediaBlocksPipeline[]][Bus_Error] Error received from element souphttpsrc_642cc830: Internal data stream error. [MediaBlocksPipeline[]][Bus_Error] Error received from element queue_v_12acd0a2: Internal data stream error.

But i used a WPF based example (with the same URL), which can play normally.

visioforge commented 2 months ago

Hi

You need to add a DecodeBinBlock block after an HTTPSourceBlock to decode MP4 file video/audio streams. UniversalSourceBlock has decoders inside.

Sample code:

_source = new HTTPSourceBlock(settings);
_videoRenderer = new VideoRendererBlock(_pipeline, VideoView1) { IsSync = false };
_decode = new DecodeBinBlock(renderAudio: false);

_pipeline.Connect(_source.Output, _decode.Input);
_pipeline.Connect(_decode.VideoOutput, _videoRenderer.Input);

If you need audio, you have to add AudioRendererBlock and connect the AudioOutput pad of DecodeBinBlock.

suyana commented 2 months ago

You're right. The problem has been resolved, thank you.