Skip to content

Commit

Permalink
Add docs for related scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikLassahn committed Mar 29, 2018
1 parent cda62f9 commit 317e1d1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 12 deletions.
25 changes: 25 additions & 0 deletions Docs/RelatedScripts.md
Original file line number Diff line number Diff line change
@@ -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`.
15 changes: 8 additions & 7 deletions Docs/Scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 14 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 317e1d1

Please sign in to comment.