当前位置:网站首页>UE plays video in scene or UMG
UE plays video in scene or UMG
2022-07-29 04:36:00 【Sakuya__】
In illusion , We sometimes think about scenes or UMG Play a video in , Here is a record of how to achieve it and the pit encountered in the middle .
Install plug-ins and import resources
Use the official plug-in Electra Player, Using this plug-in can support DX12, Check and restart the editor to enable .

First, in the Content Create one in the directory Movies Folder , Then put the video you want to play into this file directory and import it into the project ( Because when you pack, you will only put it in this folder MP4 Package files into the project , If you put it in another folder and pack it, you won't be able to play the video ).

The right choice Media->MediaPlayer Create a media player , In the pop-up dialog box, this Video output MediaTexture asset To check , Will automatically help us create a Media Texture.



Open the one we created NewMediaPlayer, You can find the video file we imported at the beginning in the following list , Double click to play . In the playback option, set the decoder to the plug-in we just imported ——Electra Player.

Play the video in the scene
Select the one just created Media Texture, The right choice Create Material, Create a material , The default name is NewMediaPlayer_Video_Mat. Want to play in the scene , First of all, create a actor, Name it BP_VideoScreen. Then add a Cube Components , And stretch it to look like the player we want , Finally, assign the material just created to Cube, Compile save .


In order to make the video of the played video have sound , You also need to add a MediaSound Components , And put it in MediaPlayer Set to the one created at the beginning NewMediaPlayer.

Once you've created it , Put this created BP_VideoScreen Drag into the scene , Then open the level blueprint . Create a MediaPlayer The variable of type is named MediaPlayer, And set its default value to the one we created at the beginning NewMediaPlayer.

And then in BeginPlay Call in event MediaPlayer Of OpenSource and Play Method , Parameters MediaSource Set as the video resource imported at the beginning . If you want to cycle , call MediaPlayer Of SetLooping Method , And put the parameters Looping Check on .

Return to the scene and run the game , You can see that we dragged into the scene BP_VideoScreen Playing video .

stay UMG Play video on
Similarly, right click Media Texture Create a material , Name it UI_MediaPlayer. Change the material type of the material output node to User Interface, Changed it to UI The output form of , Then select the material of the material template and set it to the one you created at the beginning Media Texture, Save after setting .


Then create a for playing video UMG, Add an image to fill the canvas , Set the material of the picture to the one just created UI_MediaPlayer.

stay UMG Play video in the constructor of , The node is the same as playing video in the scene .

Finally, we just need to set the key to display our UMG And play the video , In the level blueprint, press Tab Key handle UMG Add to viewport .
Play several videos
The right choice Media->Media Playlist establish , After opening, set several videos to play .


It's the same everywhere , As long as the method called in the level blueprint is changed to OpenPlaylist, And put In Playlist The parameter is set to created NewMediaPlaylist That's it .

边栏推荐
- STL source code analysis (Hou Jie) notes - STL overview
- Sequence list and linked list
- Pytorch fixed random seed & recurrence model
- There are objections and puzzles about joinpoint in afterreturning notice (I hope someone will leave a message)
- [c language] use the reverse order output of the linked list (bidirectional linked list)
- 用 ZEGO Avatar 做一个虚拟人|虚拟主播直播解决方案
- Semantic segmentation correlation
- Don't insist on 66 days. Weight generates random numbers
- spinning up安装完使用教程测试是否成功,出现Library“GLU“ not found和‘from pyglet.gl import *错误解决办法
- 9. Delay queue
猜你喜欢
![[express connection to MySQL database]](/img/a6/d68327fa74b8c94d250ea469301839.png)
[express connection to MySQL database]

Definition and implementation of stack and queue (detailed)

15.federation

Won't you just stick to 62 days? Sum of words

12. Priority queue and inert queue

Classes and objects (I)

TypeError: Cannot read properties of undefined (reading ‘then‘)

Sequence list and linked list

Pytoch distributed training

Actual combat of flutter - DIO of request encapsulation (II)
随机推荐
redux快速上手
正确的用户拖拽方式
Deep analysis of data storage in memory (Advanced C language)
[c language] PTA 7-63 falling ball
File operation (Advanced C language)
12. Priority queue and inert queue
MySQL - clustered index and secondary index
在线教育的推荐系统
【Express连接MySQL数据库】
读懂 互联网巨头 【中台之战】 以及 中台 发展思维
C language: structure simple syntax summary
pyscript无法引入包
C language: summary of consortium knowledge points
Several simple and difficult OJ problems with sequential force deduction
New year's greetings from programmers
The daily life of programmers
It won't last for 65 days. It only appears once
Christmas tree web page and Christmas tree application
MySQL - deep parsing of MySQL index data structure
Understand the Internet giant [the war between China and Taiwan] and the development thinking of China and Taiwan