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

边栏推荐
- Multi card training in pytorch
- MySQL - 聚簇索引和辅助索引
- RecyclerView通过DPAD按键上下切换焦点 切换到界面外的控件时焦点会左右乱跳
- 9.延迟队列
- Pytorch fixed random seed & recurrence model
- Oracle 插入数据
- es6和commonjs对导入导出的值修改是否影响原模块
- C language: typedef knowledge points summary
- Back propagation process of manual BP neural network
- No, just stick to it for 64 days. Find the insertion location
猜你喜欢

STL source code analysis (Hou Jie) notes -- Classification and testing of stl containers

论pyscript使用感想(实现office预览)

No, just stick to it for 64 days. Find the insertion location

Classes and objects (II)

Pycharm reports an error when connecting to the virtual machine database

What is the difference between field, variable and property

10. Fallback message

The third ACM program design competition of Wuhan University of Engineering

spinning up安装完使用教程测试是否成功,出现Library“GLU“ not found和‘from pyglet.gl import *错误解决办法

Vscode one click compilation and debugging
随机推荐
Pytoch distributed training
10. Fallback message
Vscode one click compilation and debugging
6. Pytest generates an allure Report
Use of torch.optim optimizer in pytorch
Not for 58 days. Implement prefix tree
New year's greetings from programmers
[C language] PTA 7-52 finding the sum of the first n terms of a simple interleaved sequence
[c language] PTA 7-50 output Fahrenheit Celsius temperature conversion table
读懂 互联网巨头 【中台之战】 以及 中台 发展思维
Sign the college entrance examination
Definition and implementation of stack and queue (detailed)
Classes and objects (II)
LeetCode(剑指 Offer)- 53 - I. 在排序数组中查找数字 I
9. Delay queue
C language: enumerating knowledge points summary
用 ZEGO Avatar 做一个虚拟人|虚拟主播直播解决方案
异常解决:cococaption包出现找不到edu.stanford.nlp.semgraph.semgrex.SemgrexPattern错误
Star a pathfinding in LAYA
Unity Foundation (3) -- various coordinate systems in unity