Skip to content

Commit

Permalink
TTK-26797: Show the player of the live channels (#141)
Browse files Browse the repository at this point in the history
* TTK-26797: Show the player of the live channels

* TTK-26797: Fix confcontroller file
  • Loading branch information
albacodina authored Jan 22, 2024
1 parent 91e7dd7 commit 6050758
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
53 changes: 38 additions & 15 deletions Controller/ConfController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,43 @@ public function confAction(Request $request): Response
{
$multimediaObject = $this->getMultimediaObject($request->query->get('configID'));

$jsonData = $this->renderView(
'@PumukitPaellaPlayer/Conf/conf.json.twig',
[
'xapi_endpoint' => $this->paellaXAPIEndpoint,
'xapi_auth' => $this->paellaXAPIAuth,
'access_control_class' => $this->paellaAccessControlClass,
'footprints' => $this->paellaFootPrints,
'isMonostream' => !$multimediaObject->isMultistream(),
'isMultistream' => $multimediaObject->isMultistream(),
'isLive' => $multimediaObject->isLive(),
'notLive' => !$multimediaObject->isLive(),
'hasCaptions' => $this->captionService->hasCaptions($multimediaObject),
]
);
if ($multimediaObject instanceof MultimediaObject) {
$jsonData = $this->renderView(
'@PumukitPaellaPlayer/Conf/conf.json.twig',
[
'xapi_endpoint' => $this->paellaXAPIEndpoint,
'xapi_auth' => $this->paellaXAPIAuth,
'access_control_class' => $this->paellaAccessControlClass,
'footprints' => $this->paellaFootPrints,
'isMonostream' => !$multimediaObject->isMultistream(),
'isMultistream' => $multimediaObject->isMultistream(),
'isLive' => $multimediaObject->isLive(),
'notLive' => !$multimediaObject->isLive(),
'hasCaptions' => $this->captionService->hasCaptions($multimediaObject),
]
);
}

$live = $this->documentManager->getRepository(Live::class)->findOneBy([
'_id' => new ObjectId($request->query->get('configID')),
]);

if ($live instanceof Live) {
$jsonData = $this->renderView(
'@PumukitPaellaPlayer/Conf/conf.json.twig',
[
'xapi_endpoint' => $this->paellaXAPIEndpoint,
'xapi_auth' => $this->paellaXAPIAuth,
'access_control_class' => $this->paellaAccessControlClass,
'footprints' => $this->paellaFootPrints,
'isMonostream' => true,
'isMultistream' => false,
'isLive' => true,
'notLive' => false,
'hasCaptions' => false,
]
);
}

return new Response($jsonData, 200, ['Content-Type' => 'application/json']);
}
Expand All @@ -82,7 +105,7 @@ private function getPaellaProfileFolder(Request $request): string
return self::PAELLA_DEFAULT_CONFIG_FOLDER;
}

private function getMultimediaObject(string $objectId): MultimediaObject
private function getMultimediaObject(string $objectId)
{
try {
return $this->documentManager->getRepository(MultimediaObject::class)->findOneBy(['_id' => new ObjectId($objectId)]);
Expand Down
2 changes: 1 addition & 1 deletion Controller/PaellaRepositoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function playlistAction(Request $request, Series $series): Response
return new Response($response);
}

private function getMultimediaObject(string $objectId): MultimediaObject
private function getMultimediaObject(string $objectId)
{
try {
return $this->documentManager->getRepository(MultimediaObject::class)->findOneBy(['_id' => new ObjectId($objectId)]);
Expand Down
2 changes: 2 additions & 0 deletions Resources/config/pumukit_paella_player.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ services:

Pumukit\PaellaPlayerBundle\Services\ChannelManifest:
class: Pumukit\PaellaPlayerBundle\Services\ChannelManifest
arguments:
$eventDefaultPic: "%pumukit_new_admin.advance_live_event_create_default_pic%"

Pumukit\PaellaPlayerBundle\Services\PlaylistManifest:
class: Pumukit\PaellaPlayerBundle\Services\PlaylistManifest
Expand Down
7 changes: 5 additions & 2 deletions Services/ChannelManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ class ChannelManifest
{
protected $liveService;
protected $streamsManifest;
protected $eventDefaultPic;

public function __construct(
LiveService $liveService,
StreamsManifest $streamsManifest
StreamsManifest $streamsManifest,
string $eventDefaultPic
) {
$this->liveService = $liveService;
$this->streamsManifest = $streamsManifest;
$this->eventDefaultPic = $eventDefaultPic;
}

public function create(Live $live): array
Expand All @@ -36,7 +39,7 @@ private function addMandatoryManifestMetadata(Live $live)
$data = [];
$data['id'] = $live->getId();
$data['title'] = $live->getName();
$data['preview'] = '';
$data['preview'] = $this->eventDefaultPic;
$data['duration'] = 0;

return $data;
Expand Down

0 comments on commit 6050758

Please sign in to comment.