{"id":25188410,"url":"https://github.com/adrenak/mediaplayer","last_synced_at":"2025-05-07T16:21:58.924Z","repository":{"id":117169217,"uuid":"261148290","full_name":"adrenak/mediaplayer","owner":"adrenak","description":"A standardised media player interface for Unity with subtitle parser.","archived":false,"fork":false,"pushed_at":"2020-07-27T12:22:44.000Z","size":301,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T11:51:07.936Z","etag":null,"topics":["mediaplayer","subtitles","unity","video","videoplayer"],"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/adrenak.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":"2020-05-04T10:53:17.000Z","updated_at":"2024-07-25T07:49:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"af953cd9-0aa1-4bba-8bdb-51354e4e6d2a","html_url":"https://github.com/adrenak/mediaplayer","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrenak%2Fmediaplayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrenak%2Fmediaplayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrenak%2Fmediaplayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrenak%2Fmediaplayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrenak","download_url":"https://codeload.github.com/adrenak/mediaplayer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252913073,"owners_count":21824093,"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":["mediaplayer","subtitles","unity","video","videoplayer"],"created_at":"2025-02-09T20:28:38.095Z","updated_at":"2025-05-07T16:21:58.915Z","avatar_url":"https://github.com/adrenak.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MediaPlayer\r\nA standardised media player interface for Unity. Aimed largely towards being able to make video player UI without worrying about the underlying video player.\r\n\r\n# Media Playback\r\n## The `IVideoPlayer` interface\r\n### Properties\r\n* `Texture` The `Texture` object that represents the texture on which the video plays\r\n* `IsReady` If the video player has loaded the video and the video can be played or not\r\n* `IsPlaying` If the video is presently playing. False when the video is not loaded or paused.\r\n* `Duration` The duration of the video in a `TimeSpan` object\r\n* `TotalFrames` Total number of frames in the video that has been loaded\r\n* `FrameRate` Rate of frame playback in frames per second of the loaded video\r\n* `CurrentFrame` The currently showing frame in the video player\r\n* `CurrentPosition` The normalized position of the current frame in the [0,1] rannge\r\n* `CurrentTimeSpan` The time gap between the video start and the current frame showing\r\n\r\n### Methods\r\n* `Open(string path, bool autoPlay)` Opens a video for loading via the path. `autoPlay` flag decides if the video playback should start immediately after successful loading.\r\n* `Play` Starts playing/resumes the video\r\n* `Pause` Pauses the video playback\r\n* `Stop` Stop the video playback\r\n  \r\n* `SeekFrame(long frame)` Seeks the playback to the given frame from the start of the video\r\n* `SeekTimeSpan(TimeSpan timeSpan)` Seeks the playback to a frame `timeSpan` duration from the start of the video\r\n* `SeekPosition(float position)` Seeks the playabck to a frame `position` percentage from the start of the video. Eg. .5f seeks it to the middle of the video\r\n  \r\n* `JumpFrames(long frameDelta)` Seeks to a frame `frameDelta` frames away from the current frame\r\n* `JumpTimeSpan(TimeSpan timeSpanDelta)` Seeks to a frame `timeSpanDelta` duration away from the current frame\r\n* `JumpPosition(float positionDelta)` Seeks to a frame `positionDelta` percentage from the current frame. Eg. -25f when `CurrentPosition` is .75f will take it to the middle of the video\r\n\r\n### Events\r\n* `OnReady` Fired when a video is loaded and it capable of being player\r\n* `OnError` Fired when there is an error in loading the video\r\n* `OnPlay` Fired when the video starts playing for the first time or is resumed in the middle of the playback\r\n* `OnPause` Fired when the video is paused\r\n* `OnStop` Fired when the playback is stopped\r\n* `OnSeek` Fired when the media player seeks to another frame\r\n* `OnJump` Fired when the media played jumps forward or backward by any number of frames\r\n\r\n# Subtitles\r\nSubtitle related code is a modified version of [@roguecode](https://www.github.com/roguecode)'s [Unity-Simple-SRT](https://github.com/roguecode/Unity-Simple-SRT) on GitHub.\r\n\r\n## The `SubtitleBlock` class\r\n### Properties\r\n* `Index` The Index of the block in the subtitle file.\r\n* `Length` The duration of the subtitle block in seconds\r\n* `From` The moment the subtitles should start displaying\r\n* `To` The moment the subtitles should stop displaying\r\n* `Text` The text to be displayed\r\n\r\n## The `ISubtitlesParser` interface\r\n### Methods\r\n* `GetByTime(double time)` Returns the subtitle block from the subtitle file at the specified time\r\n\r\n# Notes\r\nThe project contains the following:\r\n* `IVideoPlayer`: An implementation for Unity's VideoPlayer component. Please see `SampleMediaPlayer` under `Samples/` \r\n* `SRTParser`: An implementation of `ISubtitlesParser` for working with `SRT` subtitle format. \r\n* `SubtitleDisplayer`: A simple UI for showing the subtitles that requires an instance of `ISubstitlesParser`\r\n\r\n# Contact\r\nVatsal \"adrenak\" Ambastha  \r\n[@www](http://www.vatsalambastha.com)  \r\n[@github](https://www.github.com/adrenak)  \r\n[@npm](https://www.npmjs.com/~adrenak)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrenak%2Fmediaplayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrenak%2Fmediaplayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrenak%2Fmediaplayer/lists"}