-
-
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.8' into v1
- Loading branch information
Showing
8 changed files
with
126 additions
and
3 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
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 |
---|---|---|
|
@@ -26,4 +26,5 @@ | |
// YouTube Channel ID | ||
"youtubeChannelId" => '', | ||
"isLive" => false, | ||
"connectionToken" => '', | ||
]; |
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,47 @@ | ||
<?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.9 | ||
*/ | ||
class StreamController extends Controller | ||
{ | ||
// Protected Properties | ||
// =========== ============================================================== | ||
|
||
protected $allowAnonymous = [ | ||
'update-stream-status', | ||
]; | ||
|
||
// Public Methods | ||
// ========================================================================= | ||
|
||
|
||
/** | ||
* Toggles the stream to live or offline in plugin | ||
* | ||
* @param string $yttoken | ||
* @return | ||
*/ | ||
|
||
public function actionUpdateStreamStatus($yttoken = '') | ||
{ | ||
return YoutubeLiveEmbed::$plugin->stream->setStreamStatus($yttoken); | ||
} | ||
} |
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,44 @@ | ||
<?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\services; | ||
|
||
use nystudio107\youtubeliveembed\YoutubeLiveEmbed; | ||
use nystudio107\youtubeliveembed\helpers\PluginTemplate; | ||
|
||
use Craft; | ||
use craft\base\Component; | ||
use craft\helpers\UrlHelper; | ||
|
||
/** @noinspection MissingPropertyAnnotationsInspection */ | ||
|
||
/** | ||
* @author nystudio107 | ||
* @package YoutubeLiveEmbed | ||
* @since 1.0.0 | ||
*/ | ||
class Stream extends Component | ||
{ | ||
|
||
public function setStreamStatus($yttoken) | ||
{ | ||
$myPlugin = Craft::$app->plugins->getPlugin('youtubeliveembed'); | ||
$isLive = (YoutubeLiveEmbed::$plugin->embed->isLive() ? false : true); | ||
|
||
if ($this->getToken() == $yttoken) { | ||
return Craft::$app->plugins->savePluginSettings($myPlugin, array('isLive' => $isLive)); | ||
} | ||
} | ||
|
||
protected function getToken(): string | ||
{ | ||
return YoutubeLiveEmbed::getInstance()->settings->connectionToken; | ||
} | ||
} |
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