Browse Source

Fixed stream events

master
Shyim 7 years ago
parent
commit
d30b5ba234
  1. 4
      src/Controller/Events.php
  2. 2
      src/Controller/Streams.php

4
src/Controller/Events.php

@ -103,9 +103,9 @@ class Events extends Controller
*/ */
private function getStreamByRequest(array $data): ?Streams private function getStreamByRequest(array $data): ?Streams
{ {
$streamId = explode('_', $data['app'])[1]; $streamName = explode('/', $data['app'])[1];
$stream = $this->repository->find($streamId); $stream = $this->repository->findOneBy(['name' => $streamName]);
if ($stream !== null && $stream->getStreamKey() === $data['name']) { if ($stream !== null && $stream->getStreamKey() === $data['name']) {
return $stream; return $stream;

2
src/Controller/Streams.php

@ -73,7 +73,7 @@ class Streams extends Controller
$host = parse_url($this->container->getParameter('appHost'), PHP_URL_HOST); $host = parse_url($this->container->getParameter('appHost'), PHP_URL_HOST);
$data = $stream->jsonSerialize(); $data = $stream->jsonSerialize();
$data['streamUrl'] = sprintf('rtmp://%s/%s', $host, $stream->getUser()->getUsername() . '_' . $stream->getName()); $data['streamUrl'] = sprintf('rtmp://%s/%s', $host, $stream->getUser()->getUsername() . '/' . $stream->getName());
return new JsonResponse($data); return new JsonResponse($data);
} }

Loading…
Cancel
Save