x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

C++ UMediaTexture is not showing UMediaPlayer Frames when playing a UStreamMediaSource

As the title already describes, I'm trying to play a video from URL and use the frames in a material.

Here the code I use to load and play the video:

 VideoTexture = NewObject<UMediaTexture>(this);
 VideoTexture->AddToRoot();
 VideoSource = NewObject<UStreamMediaSource>(this);
 VideoSource->AddToRoot();
 VideoPlayer = NewObject<UMediaPlayer>(this);
 VideoPlayer->AddToRoot();
 
 // Link the Video Texture to the Media Player
 VideoTexture->SetDefaultMediaPlayer(VideoPlayer);
 VideoTexture->SetMediaPlayer(VideoPlayer);
 
 
 VideoSource->StreamUrl = VideoURL;
 VideoPlayer->SetLooping(true);
 VideoPlayer->OpenSource(VideoSource);
 VideoPlayer->PlayOnOpen = true;
 VideoPlayer->Play();
 
 SetDynamicTexture(VideoTexture); // Adds the texture to the dynamic material

For VideoURL I use a demo .mp4 video. When I just create the video player using blueprints (the usual way), the video is playing. Using C++ the video also seems to get played, since I can observe how its first buffering (print string) and then having the "IsPlaying" status. But the Texture just stays black all the time. For sure it compiles without any error or warning.

It seems like the UMediaPlayer frames get not written to the UMediaTexture when I instanciate it like in the code above, so I can have multiple independed instance of it in my level. Did I miss somthing?

I appreciate any help, thanks in advance!

Best Regards

Robin

Product Version: UE 4.19
Tags:
more ▼

asked Jul 29 '18 at 09:33 PM in C++ Programming

avatar image

RobinZinser
1 1 2

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question