Show video composition - twilio

I'm trying to show on my webpage a video from twilio that was recorded.
The REST call that I made from twilio (get composition) returns a binary file and I want to use it to show the video.
I can't use the url from twilio directly to the video src because it needs authentication and I do it on the back-end.
I can do it using the binary and encoding it to base64, the problem is that for large videos the webpage has a lazy load due to the download of the large file.
Also, I don't have the binary locally in my server, and therefore I'm getting the binary each time I need to see the video.
Can anyone help me to know how is the best way to show the video and to make it possible to be load by chunks with buffering? Because I can create a webpage that only downloads the binary and use it directly on the src of the video too, but with that I can't return x seconds back on the video or foward, I can only see it from the beggining to the end without missing anything.
Many thanks for the help :)

Twilio developer evangelist here.
I'd recommend that you download the video and store it yourself under a URL that you can set in a <video> element. That will save you downloading the video from Twilio each time and give you the control over the playback.

Related

Architecture for a web app to add overlays to users' Youtube live stream video?

I am trying to build a web app for users to easily add text (as open caption) and other assets in my app as overlays in real-time to their YouTube live stream video.
They will use their camera to record their video, and select from my app which text should be added to the video.
Then, the video will be sent to Youtube live through their API.
Here are my questions:
First of all, I was wondering if mixing video + subtitle and sending it to Youtube's rtmp url can be done from the client side, so it's simple and lightweight.
Second, should I encode the output being sent to Youtube? Can this be done from the browser too?
I'm only seeing a few node.js frameworks, and even they're not very mature (or is Webcodecs for this purpose?). Is a web app a poor choice for this task?
Lastly, if I do need a server to process the video, where should the encoding happen (from the user's machine, or in the server, or both?)? Is my server most likely going to be the bottleneck given YouTube's infrastructure, since video files are huge and my server is limited?
I am new to video streaming, so please excuse my lack of understanding of the subject. Also, if there's any good resource for my problem, please share them with me.
First of all, I was wondering if mixing video + subtitle and sending it to Youtube's rtmp url can be done from the client side, so it's simple and lightweight.
You can do the video compositing and audio mixing and what not, but browsers don't support RTMP. To get the data to an RTMP server, you need to send it to a server where it is proxied off to the final URL.
They will use their camera to record their video, and select from my app which text should be added to the video.
Yeah, that's no problem at all. Draw everything to a canvas every frame.
Second, should I encode the output being sent to Youtube?
Yes, you must. Check out the Media Recorder API.
Lastly, if I do need a server to process the video, where should the encoding happen (from the user's machine, or in the server, or both?)?
The video has to be encoded client-side to get to the server in the first place. The server can then hopefully just repackage with flv and send it along. If the browser doesn't support H.264 in its Media Recorder API, then you'll have an intermediary codec like VP8, and you'll have to transcode server-side.
A few years ago, I wrote a tutorial on how to do all of these steps here: https://github.com/fbsamples/Canvas-Streaming-Example Note that the tutorial is in the context of Facebook, but this should teach you the concepts.

please tell me the Player using in the McTube App

Can anyone please tell me which player is used in the McTube App?
Because I want to implement the same in my app.
Till now, I am playing in UIWebView but as my client suggested the player looks same as in McTube App.
The player looks like this
I tried by using LBYouTubeParser and HCYoutubeParser by using that some videos are not playing.. it is failing to play. I posted the comment for this also, maximum people are facing this problem too. https://github.com/hellozimi/HCYoutubeParser/issues/19#issuecomment-27281247
Thanks in Advance.
I think you are asking about how to parse YouTube video URL, not what player to use.
The reason why LBYouTubeParser & HCYouTubeParser aren't playing all videos is because YouTube protects some videos from being extracted by encrypting their signature (clear in VEVO videos).
the encrypted signature is found as s=.... instead of sig=....
To successfully extract the URL, you have to analyse YouTube code (html & javascript) to discover how they decrypt the signature.
Note that the decryption function changes every now & then, so you have to track their changes.
Some other javascript functions already does that, this is one of them, you can check it & do the same :)

Play the Video/Audio which is getting from the server

Is there any solution of this below one?
I have the Video/audio URLs
My Requirement is:
Is it possible to get the video/audio from the server and at the same time I have to open the player to play it(Like showing the Live-video directly in browser Field).
Means
Getting streaming into a buffer in back-end and at the same time I want to show it in the player.
If above is possible
I want to save that particular video/audio streaming data in to one file.
This blackberry KB link explains about streaming video from server. It may help you.

Blackberry, QRs, and video

I've been asked to create a QR image that, on being scanned by a smartphone, will play a short 2-minute video. The video is currently in .mp4 format, but the format can change. The video playback works fine on iPhone however I'm having some problems with the BlackBerry Bold.
When the user scans the QR code the phone directs them to a URL. Right now the URL they are directed to is http://domain.com/video.mp4. However when the user attempts to access this page they get a 413 Error "Entity too large". Basically, too much is being pushed to the client.
Reading the BlackBerryForums.com.au thread titled "Request Entity Too Large", I see you need to increase the allowed request size. But the user is able to play YouTube videos perfectly fine on their blackberry! WHY? is the youtube video size smaller? What format is YouTube using? Why does YouTube work, when my method doesn't?
I know the obvious solution here is to use YouTube as a hoster and embed the video but I am told I cannot use this quick and easy solution.
The problem is that YouTube streams the video. What you're trying to do is get the user to download the whole video file.
You may need to get a streaming server so that the video can be played.
Alternatively, reduce the filesize of the file by reducing the video resolution and bitrate, make sure the sound is mono and low bitrate as well.

What happens when an youtube swf file is buffered

Whenever a youtube or any other flash content is buffered on the browser, isn't it true that is downloaded to the client computer ? So my assumption is that, any completely buffered youtube file should be found on my client right ?
For example, when i view this video on youtube, i see that it is actually referring to this swf location 'http://s.ytimg.com/yt/swf/watch_as3-vfl144654.swf'. How does youtube actually buffer this video on my computer then ?
Note: My objective is NOT to download youtube videos as i know there are extensions available for it. I just want to know how it works :) .
Thank you in advance..
Your browser downloads the video. Look into the cache for suspiciously big files. These are flvs.

Resources