{"id":21889306,"url":"https://github.com/jacklul/usharpvideo-subtitles","last_synced_at":"2025-04-15T11:24:28.171Z","repository":{"id":78205066,"uuid":"474660487","full_name":"jacklul/USharpVideo-Subtitles","owner":"jacklul","description":"This prefab adds subtitles support to USharpVideo (or any other video player) in VRChat","archived":false,"fork":false,"pushed_at":"2025-01-21T14:05:49.000Z","size":2226,"stargazers_count":49,"open_issues_count":2,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T19:21:23.475Z","etag":null,"topics":["udon","udonsharp","unity","vrchat"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacklul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-27T14:23:26.000Z","updated_at":"2025-02-22T05:42:08.000Z","dependencies_parsed_at":"2023-10-16T08:21:21.405Z","dependency_job_id":"71d204ff-a16b-4622-89bc-2b53ba926d51","html_url":"https://github.com/jacklul/USharpVideo-Subtitles","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacklul%2FUSharpVideo-Subtitles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacklul%2FUSharpVideo-Subtitles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacklul%2FUSharpVideo-Subtitles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacklul%2FUSharpVideo-Subtitles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacklul","download_url":"https://codeload.github.com/jacklul/USharpVideo-Subtitles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249059354,"owners_count":21206141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["udon","udonsharp","unity","vrchat"],"created_at":"2024-11-28T11:23:42.758Z","updated_at":"2025-04-15T11:24:28.162Z","avatar_url":"https://github.com/jacklul.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Subtitles support for USharpVideo\n\nThis prefab adds support for SRT subtitles to [USharpVideo](https://github.com/MerlinVR/USharpVideo) - it will also work with base video players supported by VRChat (Unity and AVPro).  \nTo check this out in-game visit [this test world](https://vrchat.com/home/world/wrld_dc50af39-1f65-4c47-a0d5-d1729d5c683f).  \n\n_The core of this prefab is based on [this code](https://gist.github.com/hai-vr/b340f9a46952640f81efe7f02da6bdf6) by [Haï~](https://twitter.com/vr_hai)._  \n\n\u003ca href=\"https://i.imgur.com/IZUFwbV.png\"\u003e\u003cimg src=\"https://i.imgur.com/IZUFwbV.png\" height=\"300\"\u003e\u003c/a\u003e\n\n## Features\n\n- Load subtitles from the pasted text or URL\n- Subtitle synchronization with everyone in the instance\n- Option to use own subtitles locally\n- Rich customization with the ability to save the settings\n- Integration with [USharpVideo](https://github.com/MerlinVR/USharpVideo)\n- [Persistence](https://creators.vrchat.com/worlds/udon/persistence/) support\n\n## Requirements\n\n- [Unity 2022.3.22f1](https://unity.com/releases/editor/whats-new/2022.3.22)+ (see VRChat's [Current Unity Version](https://creators.vrchat.com/sdk/upgrade/current-unity-version/) page)\n- [VRChat SDK 3.7.4](https://creators.vrchat.com/releases/release-3-7-4/)+\n- [USharpVideo v1.0.0](https://github.com/MerlinVR/USharpVideo/releases/latest)+\n- Project created using [Creator Companion](https://vcc.docs.vrchat.com/)\n\n## Installation\n\n\u003e [!TIP]\n\u003e I suggest adding \"**subtitles**\" to your world's tags when using this prefab so that people can find worlds with subtitle support more easily.\n\n1. Import [USharpVideo](https://github.com/MerlinVR/USharpVideo/releases/latest)\n    - **This is required even if you're not planning on using it**\n\n2. Import [latest release](https://github.com/jacklul/USharpVideo-Subtitles/releases/latest) unitypackage\n\n3. Drag the `Subtitles` prefab into your scene\n    - _when using **USharpVideo** you can also drag `Subtitles` prefab into `USharpVideo` in your scene and reset `Subtitles` object's transform values_\n\n4. When a window asking you to import **TextMeshPro Essentials** appears - just do it\n\n5. Add a reference in the `Subtitles` object (**SubtitleManager** script) to:\n    - when using **USharpVideo** (**Target Video Player** field) - **USharpVideoPlayer** from the `USharpVideo` object\n    - in any other case (**Base Video Player** field) - **VRCUnityVideoPlayer** or **VRCAVProVideoPlayer** that have to be somewhere in your scene - depends on which one you're using ([you can change this dynamically](#subtitlemanagersetvideoplayerbasevrcvideoplayer-void))\n\n6. Add a reference in the `Subtitles/Overlay` object (**Video Screen** field) to the video player's screen object, the overlay will copy the position and rotation of the screen on start\n    - if this doesn't work on your world then you will have to manually adjust `Subtitles/Overlay` object's position and rotation to match the video screen object (while keeping the mentioned earlier field empty)\n\n## Upgrading\n\n1. Delete the prefab from your scene\n\n2. Import new package\n\n3. Re-do [Installation](#installation) steps 3. 5. and 6. \n\n## Quick API reference\n\nMethods that you might be interested in using when integrating this prefab with other stuff in your world.\n\n- [SubtitleManager.SetVideoPlayer(BaseVRCVideoPlayer): void](#subtitlemanagersetvideoplayerbasevrcvideoplayer-void)\n- [SubtitleManager.HasSubtitles(): bool](#subtitlemanagerhassubtitles-bool)\n- [SubtitleManager.ProcessInput(string): void](#subtitlemanagerprocessinputstring-void)\n- [SubtitleManager.ProcessURLInput(VRCUrl): void](#subtitlemanagerprocessurlinputvrcurl-void)\n- [SubtitleManager.ClearSubtitles(): void](#subtitlemanagerclearsubtitles-void)\n- [SubtitleManager.IsLocked(): bool](#subtitlemanagerislocked-bool)\n- [SubtitleManager.SetLocked(bool): void](#subtitlemanagersetlockedbool-void)\n- [SubtitleManager.IsEnabled(): bool](#subtitlemanagerisenabled-bool)\n- [SubtitleManager.SetEnabled(bool): void](#subtitlemanagersetenabledbool-void)\n- [SubtitleManager.IsLocal(): bool](#subtitlemanagerislocal-bool)\n- [SubtitleManager.SetLocal(bool): void](#subtitlemanagersetlocalbool-void)\n- [SubtitleManager.IsSyncedURL(): bool](#subtitlemanagerissyncedurl-bool)\n- [SubtitleManager.ReloadSyncedURL(): bool](#subtitlemanagerreloadsyncedurl-bool)\n- [SubtitleManager.SynchronizeSubtitles(): void](#subtitlemanagersynchronizesubtitles-void)\n- [SubtitleOverlayHandler.GetCanvasTransform(): Transform](#subtitleoverlayhandlergetcanvastransform-transform)\n- [SubtitleOverlayHandler.MoveOverlay(GameObject): void](#subtitleoverlayhandlermoveoverlaygameobject-void)\n- [SubtitleControlHandler.IsSettingsPopupActive(): bool](#subtitlecontrolhandlerissettingspopupactive-bool)\n- [SubtitleControlHandler.ToggleSettingsPopup(): void](#subtitlecontrolhandlertogglesettingspopup-void)\n- [SubtitleControlHandler.ImportSettingsFromString(string): void](#subtitlecontrolhandlerimportsettingsfromstringstring-void)\n\n### SubtitleManager.SetVideoPlayer(BaseVRCVideoPlayer): void\n\nUse this to change the video player reference that the subtitles are synced with\n\n- Does nothing when using **USharpVideo**\n\n### SubtitleManager.HasSubtitles(): bool\n\nCheck whenever subtitles are currently loaded\n\n- It will return `true` if subtitles are loaded for the current mode (`IsLocal()`)\n\n### SubtitleManager.ProcessInput(string): void\n\nLoads subtitles from the text string globally or locally (depending on `IsLocal()` value)\n\n- When using **USharpVideo** - only the player who can control the video player can do this\n- For other video players - if `IsLocked()` is `true` then only the Master can do this\n- To check whenever player is able to execute this - use `SubtitleManager.CanControlSubtitles()`\n\n### SubtitleManager.ProcessURLInput(VRCUrl): void\n\nLoads subtitles from the URL globally or locally (depending on `IsLocal()` value)\n\n- When using **USharpVideo** - only the player who can control the video player can do this\n- For other video players - if `IsLocked()` is `true` then only the Master can do this\n- To check whenever player is able to execute this - use `SubtitleManager.CanControlSubtitles()`\n\n### SubtitleManager.ClearSubtitles(): void\n\nClears the subtitles globally or locally (depending on `IsLocal()` value)\n\n- When using **USharpVideo** - only the player who can control the video player can do this\n- For other video players - if `IsLocked()` is `true` then only the Master can do this\n- To check whenever player is able to execute this - use `SubtitleManager.CanControlSubtitles()`\n\n### SubtitleManager.IsLocked(): bool\n\nWhenever the access is locked to Master only\n\n- When using **USharpVideo** it shares the same state with it\n\n### SubtitleManager.SetLocked(bool): void\n\nChange lock state, must be executed by the Master\n\n- Does nothing when used with **USharpVideo** as it shares the same state with it\n- This can fail if the synchronization is ongoing - check if `SubtitleManager.IsSynchronized()` is `true` before running it\n- To check whenever player is able to execute this - use `SubtitleManager.IsPrivilegedUser(VRCPlayerApi)`\n\n### SubtitleManager.IsEnabled(): bool\n\nWhenever the subtitles are enabled for the the player\n\n### SubtitleManager.SetEnabled(bool): void\n\nEnable or disable the subtitles for the the player\n\n### SubtitleManager.IsLocal(): bool\n\nWhenever the player is using local subtitles\n\n### SubtitleManager.SetLocal(bool): void\n\nSwitch between using global and local subtitles\n\n### SubtitleManager.IsSyncedURL(): bool\n\nCheck if URL was synced or not, make sure to also check if `SubtitleManager.IsSynchronized()` is `true`\n\n- If this is false and `SubtitleManager.IsSynchronized()` is `true` then subtitles from pasted text are used\n\n### SubtitleManager.ReloadSyncedURL(): bool\n\nReload data from synced URL, can be used to retry failed requests\n\n- This is done locally, anyone can call this\n\n### SubtitleManager.SynchronizeSubtitles(): void\n\nRe-synchronizes the subtitles globally, only the person who loaded them can do this (or the master if the synchronization is finished) - this can change when that person leaves the instance or lock state changes - check the `SubtitleManager.gameObject` owner in this case\n\n- This can fail if the synchronization is ongoing - check if `SubtitleManager.IsSynchronized()` is `true` before running it\n- To check whenever player is able to execute this - use `SubtitleManager.CanSynchronizeSubtitles()`\n\n### SubtitleOverlayHandler.GetCanvasTransform(): Transform\n\nUse this method to get transform values of the overlay's `Canvas` in case you want to display something on the same screen\n\n### SubtitleOverlayHandler.MoveOverlay(GameObject): void\n\nMoves the overlay to the given object's transform values\n\n- Make sure that the settings popup is not visible at this time as it will stay in the old position until it is re-opened\n\n### SubtitleControlHandler.IsSettingsPopupActive(): bool\n\nCheck if settings popup is currently open\n\n### SubtitleControlHandler.ToggleSettingsPopup(): void\n\nToggle settings popup, use this to show and hide the popup using separate button\n\n### SubtitleControlHandler.ImportSettingsFromString(string): void\n\nImport settings from the given string (the same string which is displayed in the settings window), the format is pretty easy to figure out\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacklul%2Fusharpvideo-subtitles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacklul%2Fusharpvideo-subtitles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacklul%2Fusharpvideo-subtitles/lists"}