From 3a8306b6be6908590ebe61575c878333cc672381 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 1 Feb 2019 17:57:18 -0500 Subject: [PATCH 1/3] Added a controller endpoint so the `is-live` and `live-viewers` can be pinged dynamically via JavaScript Signed-off-by: Andrew Welch --- src/controllers/InfoController.php | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/controllers/InfoController.php diff --git a/src/controllers/InfoController.php b/src/controllers/InfoController.php new file mode 100644 index 0000000..7e841de --- /dev/null +++ b/src/controllers/InfoController.php @@ -0,0 +1,56 @@ +embed->isLive(); + } + + /** + * Returns the number of people currently viewing the live stream + * + * @return int + */ + public function actionLiveViewers(): int + { + return YoutubeLiveEmbed::$plugin->embed->liveViewers(); + } +} From da37e11872ed620a4f2ceabad37c9764fe5f4afe Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 1 Feb 2019 17:57:25 -0500 Subject: [PATCH 2/3] Added a controller endpoint so the `is-live` and `live-viewers` can be pinged dynamically via JavaScript Signed-off-by: Andrew Welch --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b91f90..9da4754 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This plugin allows you to embed a YouTube live stream and/or live chat on your w ## Requirements -This plugin requires Craft CMS 3.0.0-beta.23 or later. +This plugin requires Craft CMS 3.0.0 or later. ## Installation @@ -128,6 +128,12 @@ To determine if the YouTube Video Stream is live, you can do: {% endif %} ``` +You can also ping the YouTube Live Embed controller via JavaScript to get a dynamic result: + +``` +/actions/youtubeliveembed/info/is-live +``` + ### Determining the Number of Live Viewers To determine the number of viewers watching the live YouTube Video Stream, you can do: @@ -136,6 +142,12 @@ To determine the number of viewers watching the live YouTube Video Stream, you c {% set liveViewers = craft.youtubelive.liveViewers() %} ``` +You can also ping the YouTube Live Embed controller via JavaScript to get a dynamic result: + +``` +/actions/youtubeliveembed/info/live-viewers +``` + ## YouTube Live Embed Roadmap Some things to do, and ideas for potential features: From 214798910c41eb58610e8d5a67ee6318c1f906e7 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 1 Feb 2019 17:57:45 -0500 Subject: [PATCH 3/3] Version 1.0.1 Signed-off-by: Andrew Welch --- CHANGELOG.md | 4 ++++ composer.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74de517..60ee0f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # YouTube Live Embed Changelog +## 1.0.1 - 2019-02-01 +### Added +- Added a controller endpoint so the `is-live` and `live-viewers` can be pinged dynamically via JavaScript + ## 1.0.0 - 2019-01-12 ### Added - Initial release diff --git a/composer.json b/composer.json index 9dcfe44..2319ee1 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "nystudio107/craft-youtubeliveembed", "description": "This plugin allows you to embed a YouTube live stream and/or live chat on your webpage", "type": "craft-plugin", - "version": "1.0.0", + "version": "1.0.1", "keywords": [ "craft", "cms",