How to Create Dynamic Material Instance and Assign Texture Parameter Value for Video Playback in Unreal Engine?

I’m working on implementing video playback functionality in my Unreal Engine project using a dynamic material instance and a texture parameter. Here’s my setup:

  1. I have a widget, WBP_Movie_Player, where I call a blueprint named BP_TransitionVideoController.
  2. In the construction script of BP_TransitionVideoController, I dynamically create a media player and texture.
  3. On Begin Play, I’m attempting to create a dynamic material instance and set the texture parameter value to assign the texture to the material.

However, I am stuck on how to create the Transition Video Material at runtime.

Could someone guide me on the correct approach to creating dynamic material instances and setting texture parameter values in Unreal Engine for video playback? Any insights or code examples would be greatly appreciated.

Here’s a snippet of my current implementation: