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
10 changes: 10 additions & 0 deletions Assets/USharpVideo/Scripts/Utility/RenderTextureOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using VRC.SDKBase;
using VRC.Udon;
using System.IO;
using static VRC.SDKBase.VRCShader;

#if UNITY_EDITOR && !COMPILER_UDONSHARP
using UnityEditor;
Expand All @@ -25,13 +26,19 @@ public class RenderTextureOutput : UdonSharpBehaviour
#pragma warning restore CS0649

public CustomRenderTexture outputTexture;
public bool useUdonGlobalTexture;

private Material outputMat;

private void Start()
{
outputMat = outputTexture.material;
videoPlayerManager = sourceVideoPlayer.GetComponentInChildren<VideoPlayerManager>(true);

if(useUdonGlobalTexture)
{
SetGlobalTexture(PropertyToID("_Udon_VideoTex"), outputTexture);
}
}

private Texture lastTex;
Expand Down Expand Up @@ -107,11 +114,13 @@ void CreateCRT()

private SerializedProperty sourceVideoPlayerProperty;
private SerializedProperty outputTextureProperty;
private SerializedProperty useUdonGlobalTextureProperty;

private void OnEnable()
{
sourceVideoPlayerProperty = serializedObject.FindProperty("sourceVideoPlayer");
outputTextureProperty = serializedObject.FindProperty("outputTexture");
useUdonGlobalTextureProperty = serializedObject.FindProperty("useUdonGlobalTexture");
}

public override void OnInspectorGUI()
Expand All @@ -124,6 +133,7 @@ public override void OnInspectorGUI()
EditorGUILayout.HelpBox("A source video player must be specified", MessageType.Error);

EditorGUILayout.PropertyField(outputTextureProperty);
EditorGUILayout.PropertyField(useUdonGlobalTextureProperty);

serializedObject.ApplyModifiedProperties();

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# USharpVideo
A basic video player made for VRChat using Udon and UdonSharp. Supports normal videos and live streams.
# USharpVideo Plus
A slightly extended version of the classic basic video player made for VRChat using Udon and UdonSharp by Merlin. Supports normal videos and live streams.

![image](https://user-images.githubusercontent.com/36685500/121757261-d4acc480-cad1-11eb-9455-c61b676b9e99.png)

Expand All @@ -17,6 +17,7 @@ A basic video player made for VRChat using Udon and UdonSharp. Supports normal v
- Volume slider
- Reload button
- Supports YouTube link resolution in the editor the same as in VRC
- Global render texture

## Installation
1. Install the latest VRCSDK and latest release of UdonSharp using the [VRChat Creator Companion](https://vrchat.com/home/download)
Expand Down