From 317e1d1f59087c4ade40515950e64d3f6329cdc7 Mon Sep 17 00:00:00 2001 From: Jannik Lassahn Date: Thu, 29 Mar 2018 10:10:09 +0200 Subject: [PATCH] Add docs for related scripts --- Docs/RelatedScripts.md | 25 +++++++++++++++++++++++++ Docs/Scripts.md | 15 ++++++++------- Readme.md | 19 ++++++++++++++----- 3 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 Docs/RelatedScripts.md diff --git a/Docs/RelatedScripts.md b/Docs/RelatedScripts.md new file mode 100644 index 0000000..e2e8934 --- /dev/null +++ b/Docs/RelatedScripts.md @@ -0,0 +1,25 @@ +# Related scripts + +## Timline.cs + +A custom `Selectable` that is basically a slider component, but with some adjustments to make it behave and look like a proper timeline, e.g a seeking preview and a tooltip that shows the current position. + +## OverlayController.cs + +A component that helps wih overlays, like the settings panel in the YoutTube sample. It takes a `Target` GameObject that is set active with a call to `Show` and inactive with a call to `Hide` or if the user clicks outside of the target panel. The behaviour closely resembles the built in `Dropdown` component. + +## DisplayController.cs + +Controls where content is placed in fullscreen mode. This script stores anchors and offsets of its target before going into fullscreen and restores them once it goes back to normal. This also works if the application itself is fullscreen. + +## AnimationCurveAnimator + +A base class for simple in and out animations using `AnimationCurve`s and couroutines. + +## CanvasGroupAnimator + +Subclass of `AnimationCurveAnimator` that animates the alpha value of a `CanvasGroup`. + +## ScaleTransformAnimator + +Subclass of `AnimationCurveAnimator` that animates the scale value of a `Transform`. \ No newline at end of file diff --git a/Docs/Scripts.md b/Docs/Scripts.md index 672be18..4fb8f60 100644 --- a/Docs/Scripts.md +++ b/Docs/Scripts.md @@ -15,13 +15,14 @@ Helps to control Unitys `VideoPlayer` component through wrapper methods and easy ### Methods -| Name | Description -| ---- | ----------- -| `PrepareForUrl(string url)` | Prepares the video to play the video specified in the URL. -| `Play()` | Plays the video or tries to prepare it. -| `Pause()` | Pauses the video. -| `TogglePlayPause()` | Toggles between play and pause. -| `Seek(float time)` | Jumps to the specified time in the video. The parameter must be between 0 and 1, where 0 is the beginning and 1 the end of the video. +| Name | Description +| ---- | ----------- +| `PrepareForUrl(string url)` | Prepares the video to play the video specified in the URL. +| `Play()` | Plays the video or tries to prepare it. +| `Pause()` | Pauses the video. +| `TogglePlayPause()` | Toggles between play and pause. +| `Seek(float time)` | Jumps to the specified time in the video. The parameter must be between 0 and 1, where 0 is the beginning and 1 the end of the video. +| `SetPlaybackSpeed(float speed)` | Sets the speed at which the video is supposed to play. Common values are 0.25, 0.75, 1.0, 1.25 and 1.5. ### Events diff --git a/Readme.md b/Readme.md index 1d55e5f..50efc4f 100644 --- a/Readme.md +++ b/Readme.md @@ -4,20 +4,29 @@ VideoPlayer Helper contains useful scripts and samples to help building great ex ## Samples -| YouTube | Vimeo | -| --- | --- | -|![YouTube Player Image][YouTube] |![Vimeo Player Image][Vimeo] | +| YouTube | Vimeo | +| --- | --- | +|![YouTube Player Image][YouTube] |![Vimeo Player Image][Vimeo] | +| :arrow_forward: Live [Demo] available | - | Each sample demonstrates a different approach in using the helper classes (including some animations). +## Integration + +1. Get the *.unitypackage* from [Releases] (TODO) or clone this repository and create your own. +2. In Unity choose *Assets -> Import Package... -> Custom Package...* and select the appropriate *.unitypackage* +3. To add a template for the video player click right in the Hierarchy panel and choose Video -> Video Player with Controls +4. Set your assets. Take a look at the samples for some inspiration. + ## Scripts * [VideoController.cs](Docs/Scripts.md#VideoController.cs) * [VideoPresenter.cs](Docs/Scripts.md#VideoPresenter.cs) - -TODO: other scripts + * [other scripts](Docs/RelatedScripts.md) [VideoPlayer]: https://docs.unity3d.com/ScriptReference/Video.VideoPlayer.html [YouTube]: Docs/Images//YouTubePlayer.jpg "YouTube Sample" [Vimeo]: Docs/Images/VimeoPlayer.jpg "Vimeo Sample" +[Demo]: https://janniklassahn.github.io/unity-videoplayer-helper/ +[Releases]: https://github.com/JannikLassahn/unity-videoplayer-helper/releases \ No newline at end of file