0

So I use Pubnub for WebRTC in my Symfony 2 application, and all works well, apart from the showing of videos of other users. What happens is that when a user connects, an url gets generated like this one:

mediastream:http://www.domain.com/cd024a62-02fa-42eb-8f52-621074ea887e

These url's are temporary, and the only purpose is to serve as a way to connect video streams. After the WebRTC session the do not exist anymore and they are impossible to predict.

Since the Symfony router cannot find a route to 'http://www.domain.com/cd024a62-02fa-42eb-8f52-621074ea887e', the stream is never showed (www.domain.com is the url to the symfony application in this example).

What I could do is adapt the exisiting scripts so that all video streams look like 'http://www.domain.com/video/cd024a62-02fa-42eb-8f52-621074ea887e', but in that case any route with prefix /video/ should be left alone by Symfony.

Any ideas?

Marcel de Hoog
  • 180
  • 1
  • 11
  • question is bit unclear, can you add more details on the routes and those routes are supposed to be handled ? – Vamsi Krishna B Apr 14 '16 at 12:20
  • Tried to explain the question a bit better. The routes are created by the Pubnub Webrtc script, so it is not a part of symfony in fact. It would work if the routing system leaves all routes with a certain prefix alone, but I would not know how that is done. – Marcel de Hoog Apr 14 '16 at 12:27
  • I'm not sure the phrase *routes are create by the PubNub WebRTC script* is completely accurate. PubNub is just the signal protocol to trade connection details between clients. The video will be streamed outside of PubNub which is likely where the issue lies. See KB article [Does PubNub Provide WebRTC and Video Chat](https://www.pubnub.com/knowledge-base/discussion/252/does-pubnub-provide-webrtc-and-video-chat#latest) for complete details. – Craig Conover Apr 19 '16 at 04:47
  • Hi Craig, actually the script does generate the url to the stream. The code for that is: video.src = URL.createObjectURL(stream); Now if I could only put a subdirectory in that, I would be saved, but so far no luck. – Marcel de Hoog Apr 19 '16 at 07:12

1 Answers1

0

In the end I found a solution. As a last routing rule I added:

display_blob: defaults: { _controller: Bundlename:Main:blob } path: /{blob}

Then I created a function in the Main controller:

public function blobAction(Request $request) { $path = $request->getUri(); return $this->render($path); }

Of course I need to do some filtering of the URL itself and check if it really is a stream, but for now I am happy it works.

Marcel de Hoog
  • 180
  • 1
  • 11