Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Assets/USharpVideo/Scripts/USharpVideoPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,13 @@ public void RegisterControlHandler(VideoControlHandler newControlHandler)
VideoPlayerManager manager = GetVideoManager();
newControlHandler.SetVolume(manager.GetVolume());
newControlHandler.SetMuted(manager.IsMuted());

if (IsUsingUnityPlayer())
newControlHandler.SetToVideoPlayerMode();
else
newControlHandler.SetToStreamPlayerMode();
}

public void UnregisterControlHandler(VideoControlHandler controlHandler)
{
if (_registeredControlHandlers == null)
Expand Down Expand Up @@ -1442,6 +1447,8 @@ public void RegisterScreenHandler(VideoScreenHandler newScreenHandler)
return;
}

newScreenHandler.UpdateVideoTexture(_lastAssignedRenderTexture, IsUsingAVProPlayer());

VideoScreenHandler[] newControlHandlers = new VideoScreenHandler[_registeredScreenHandlers.Length + 1];
_registeredScreenHandlers.CopyTo(newControlHandlers, 0);
_registeredScreenHandlers = newControlHandlers;
Expand Down Expand Up @@ -1490,7 +1497,7 @@ private void UpdateRenderTexture()

foreach (VideoScreenHandler handler in _registeredScreenHandlers)
{
if (handler)
if (handler && handler.GetVideoTexture() != renderTexture)
{
handler.UpdateVideoTexture(renderTexture, IsUsingAVProPlayer());
}
Expand Down
11 changes: 1 addition & 10 deletions Assets/USharpVideo/Scripts/Utility/VideoScreenHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ public class VideoScreenHandler : UdonSharpBehaviour
private Renderer targetRenderer;
private Texture lastRenderTexture;

private void Start()
{
targetRenderer = GetComponent<Renderer>();

OnEnable();
}

private void OnEnable()
{
targetRenderer = GetComponent<Renderer>();
SetSourceVideoPlayer(sourceVideoPlayer);
}

Expand All @@ -57,9 +51,6 @@ public Texture GetVideoTexture()

public void UpdateVideoTexture(Texture renderTexture, bool isAVPro)
{
if (renderTexture == lastRenderTexture)
return;

if (targetRenderer)
{
Material rendererMat;
Expand Down