-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.0.1' into v1
- Loading branch information
Showing
4 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* YouTube Live Embed plugin for Craft CMS 3.x | ||
* | ||
* This plugin allows you to embed a YouTube live stream and/or live chat on your webpage | ||
* | ||
* @link https://nystudio107.com | ||
* @copyright Copyright (c) 2019 nystudio107 | ||
*/ | ||
|
||
namespace nystudio107\youtubeliveembed\controllers; | ||
|
||
use nystudio107\youtubeliveembed\YoutubeLiveEmbed; | ||
|
||
use Craft; | ||
use craft\web\Controller; | ||
|
||
/** | ||
* @author nystudio107 | ||
* @package YoutubeLiveEmbed | ||
* @since 1.0.0 | ||
*/ | ||
class InfoController extends Controller | ||
{ | ||
// Protected Properties | ||
// ========================================================================= | ||
|
||
protected $allowAnonymous = [ | ||
'is-live', | ||
'live-viewers', | ||
]; | ||
|
||
// Public Methods | ||
// ========================================================================= | ||
|
||
|
||
/** | ||
* Returns whether the stream is currently live | ||
* | ||
* @return bool | ||
*/ | ||
public function actionIsLive(): bool | ||
{ | ||
return YoutubeLiveEmbed::$plugin->embed->isLive(); | ||
} | ||
|
||
/** | ||
* Returns the number of people currently viewing the live stream | ||
* | ||
* @return int | ||
*/ | ||
public function actionLiveViewers(): int | ||
{ | ||
return YoutubeLiveEmbed::$plugin->embed->liveViewers(); | ||
} | ||
} |