当前位置:网站首页>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 .

边栏推荐
- Can you really write restful API?
- Exception resolution: error of not finding edu.stanford.nlp.semgraph.semgrex.semgrexpattern in cococaption package
- Pycharm reports an error when connecting to the virtual machine database
- 12. Priority queue and inert queue
- Makefile(make)常见规则(二)
- Don't stick to it for 68 days. Baboons eat bananas
- Mongo shell interactive command window
- C language force buckle question 61 of the rotating list. Double ended queue and construction of circular linked list
- Realize the effect of univariate quadratic equation through JS. Enter the coefficients of a, B and C to calculate the values of X1 and x2
- 命令行交互工具(最新版) inquirer 实用教程
猜你喜欢

There are objections and puzzles about joinpoint in afterreturning notice (I hope someone will leave a message)

用 ZEGO Avatar 做一个虚拟人|虚拟主播直播解决方案

No, just stick to it for 59 days

File operation (Advanced C language)
![[QT learning notes] * insert pictures in the window](/img/72/ecac8fb35a404130ee020db572a4b4.png)
[QT learning notes] * insert pictures in the window

STL source code analysis (Hou Jie) notes - STL overview

Definition and implementation of stack and queue (detailed)

谷歌浏览器 打开网页出现 out of memory

命令行交互工具(最新版) inquirer 实用教程

Update learning materials daily
随机推荐
GCC基础知识
10. Fallback message
MySQL - 深入解析MySQL索引数据结构
异常处理:pyemd或PyEMD找不到
Mpc5744p introduction and opensda firmware update
你真的会写Restful API吗?
mpc5744p简介与OpenSDA固件更新
[c language] use the reverse order output of the linked list (bidirectional linked list)
Basic operation of queue
Go面向并发的内存模型
Not for 63 days. The biggest XOR
14. Haproxy+kept load balancing and high availability
Pytoch automatic mixing accuracy (AMP) training
论pyscript使用感想(实现office预览)
Auto.js脚本开发环境搭建
MySQL - clustered index and secondary index
Classes and objects (I)
Auto.js脚本开发入门
正确的用户拖拽方式
I++ and ++i details