Skip to content

Commit

Permalink
few updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jibon57 committed May 4, 2022
1 parent c408260 commit 4067e45
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
5 changes: 3 additions & 2 deletions examples/plugNmeetConnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function createRoom(string $roomId, string $roomTitle, string $welcomeMes
if (isset($roomMetadata['default_lock_settings'])) {
$defaultLocks = $roomMetadata['default_lock_settings'];
$lockSettings = new LockSettingsParameters();

if (isset($defaultLocks['lock_microphone'])) {
$lockSettings->setLockMicrophone($defaultLocks['lock_microphone']);
}
Expand Down Expand Up @@ -220,13 +220,14 @@ public function createRoom(string $roomId, string $roomTitle, string $welcomeMes
* @param bool $isAdmin
* @return GenerateJoinTokenResponse
*/
public function getJoinToken(string $roomId, string $name, string $userId, bool $isAdmin): GenerateJoinTokenResponse
public function getJoinToken(string $roomId, string $name, string $userId, bool $isAdmin, bool $isHidden = false): GenerateJoinTokenResponse
{
$generateJoinTokenParameters = new GenerateJoinTokenParameters();
$generateJoinTokenParameters->setRoomId($roomId);
$generateJoinTokenParameters->setName($name);
$generateJoinTokenParameters->setUserId($userId);
$generateJoinTokenParameters->setIsAdmin($isAdmin);
$generateJoinTokenParameters->setIsHidden($isHidden);

return $this->plugnmeet->getJoinToken($generateJoinTokenParameters);
}
Expand Down
7 changes: 5 additions & 2 deletions examples/quickJoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
$max_participants = 0; // value 0 means no limit (unlimited)
$user_full_name = "Your name";
$userId = "Your-Unique-User-Id"; // must be unique for each user.
$isAdmin = true;

$roomMetadata = array(
"room_features" => array(
Expand Down Expand Up @@ -98,9 +99,11 @@

if ($isRoomActive && $output->status) {
try {
$join = $connect->getJoinToken($roomId, $user_full_name, $userId, true);
$join = $connect->getJoinToken($roomId, $user_full_name, $userId, $isAdmin);

$output->url = "<br>" . $config->plugnmeet_server_url . "?access_token=" . $join->getToken();
if ($join->getStatus()) {
$output->url = "<br>" . $config->plugnmeet_server_url . "?access_token=" . $join->getToken();
}
$output->status = $join->getStatus();
$output->msg = $join->getResponseMsg();
} catch (Exception $e) {
Expand Down
4 changes: 2 additions & 2 deletions src/Parameters/GenerateJoinTokenParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class GenerateJoinTokenParameters
/**
* @var bool
*/
protected $isAdmin;
protected $isAdmin = false;
/**
* @var bool
*/
protected $isHidden;
protected $isHidden = false;

/**
* @var UserMetadataParameters
Expand Down
8 changes: 7 additions & 1 deletion src/Responses/BaseResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public function getStatus(): bool
*/
public function getResponseMsg(): string
{
return $this->rawResponse->msg;
$msg = $this->rawResponse->msg;

if (is_array($msg)) {
return json_encode($msg);
}

return $msg;
}
}
2 changes: 1 addition & 1 deletion src/Responses/GenerateJoinTokenResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ class GenerateJoinTokenResponse extends BaseResponse
*/
public function getToken(): string
{
return $this->rawResponse->token;
return $this->rawResponse->token ?? "";
}
}

0 comments on commit 4067e45

Please sign in to comment.