How to get live views count on livestreaming in laravel 9? - live-streaming

I am using co-streamer as a streaming server, also plyr as a video player.
In my mind one approach is to get number of views in a specific method and call in ajax with setTimeInterval method.
But there might be some best way or package to do it?
Any good suggestion about approach or package about views count just like youtube?

You have 2 approaches.
Either you can use socket communication and send back number of live user. You will need some kine of identifier i.e Principal Id if talking in terms of Spring In java
Or as you mentioned use some kind of polling to get counts

Related

How to add pagination in API

I want to know how to add pagination in APIs for enhanced data retrieval most specifically the youtube API!
I didn't try out anything so far as it's a new concept towards me!
What i personally do usually is one of two things,
(the most preferred way for me) I create more than one API Token. every X requests i dynamically change the API that executes the request., then it avoids throttlings.
When requesting or sending a large amount of requests, you can stop dynamically every X time.

How do I create a private and public API architecture

I got a project assigned where we already have an up and running website and one of our clients wants to be able to track statistics from the website.
We want to make this available to all our clients as soon as we finish the development. Note that each 'client' have their own 'subdomain' to say so. Eg. www.website.com/client1 , www.website.com/client2 , etc. And we want to track the usage separately for each of these clients.
We will need to create statistics based on the usage of our own platform, pull in data registered by Google Analytics and also pull in data from a 3rd party which they will offer by an API of their own (they have a 3rd party solution that uses the data accessible via our API).
All this data needs to be shown on a webpage with graphs and tables.
I wanted to make sure we choose the right architecture from the start, in order to avoid scalability issues later on.
Started reading about Private and Public API's lately.
For now, we do not have another (internal) application yet that would use our own statisics, it would just be the website using it. But in order to be able to scale-up later if needed, and another application would like to use the statistics I think a private API would benefit us greatly.
In order to allow 3rd parties to use the statistical data we chose to let out, I was thinking of creating a Public API.
Is a Private&Public API the correct way to go about this?
One of the questions I am stuck with is how does the architecture for these API's look like. Mostly, right now we already have a public API regarding vacancy data. This 'API' is basically just a PHP class (controller) inside our CodeIgniter solution. It gets called via its URL and returns a JSON object with the results. (e.g. www.website.com/api/vacancy/xxx)
In order to create a (proper) private & public API solution/architecture. Should the API be set free from the website (CodeIgniter)? What are the common go-to solutions for this?
Or is it fine to keep it in our current platform the way it is now? (and people call the stats API via www.website.com/api/stats/xxx for example?)
It's almost always right to go with microservices like architecture so your initial thoughts sounds reasonable. Acting like this will give the possibility to scale and deploy your api independently and also will help you avoid performance side effects to your site (and vice versa). Pay attention how you access your main site data from within the new api if you don't want to finish with a monolith application.
Regarding the API i would suggest you to implement protocol like oauth2 in order to achieve the flexibility you (might) need. Also you can use swagger to document and test your API.
All i said might helps you a lot but first you have to answer yourself do you really need to go so deep or you just need a simple solution.
I think multitenancy is the best choice. Generally speaking, multitenancy is when every customer has own database. Data is separate. The codebase is same and already exists. As I understood the project is in progress status. You do not redesign and rewrite anything.

Tokbox OpenTok client to call another client

I want to build an application where it is possible for one client to call another client using webRTC. I've started to look into webRTC providers and I've found Toxbox among others.
Is it possible, using TokBox OpenTok, for a client to actually make a call to another client (similar as a regular phone call)? From their docs and specifications it seems that it is only possible to create a "session" (a room in which participants meet and chat).
Am I missing something, or are they only providing sessions that people join/leave?
Twilio seem to offer what I need here,
but I find it strange that I cannot find something similar at Tokbox.
Thanks,
Muff
Yes it is possible.
You need to make the distinction between the type of API the platform exposes to what you can do with it.
While the OpenTok API is built around the concept of a room/session - you can easily use that concept to create a call. There are many openTok developers who do just that.
Twilio indeed offers the same capability - as are many others (a partial list can be found in this report - https://bloggeek.me/webrtc-paas-report/ - while the report is a paid one, the list is available on that page

Cumulocity extend API

We're working with Cumulocity and we'd like to offer services to our customers that are not currently possible to implement with Cumulocity. As an example, we'd like to be able to retrieve a list of devices located within x kilometers of a given point.
Currently there are two limitations that prevent us from doing so:
the impossibility of extending the Cumulocity API with custom route/parameters
the impossibility of implementing custom functions for specific API GET calls
I can think of a workaround to achieve this, like a POST request of an event that would be processed by an Esper rule, generating another event/measurement that could then be accessed by a GET. But I think we can agree this is not a suitable mechanism.
Please not that the use case I described above is just an example. Our needs don't limit to this and we need a standardized way to expand our services without requirering updates on Cumulocity side.
There are two topics here, I believe:
Geo-querying: Some geographical querying and aggregation use cases can be handled through CEL. A general geo-querying API is on the Cumulocity roadmap. Note: This use case is not only related to extending the API, as such queries go right down into the database.
Extending the API: That is actually possible. Cumulocity has a microservices API in which you can expose other APIs under the URL /services/.... This is, for example, how connectivity platforms are interfaced. The API is not on the web site because it's not GA yet, but you can certainly discuss it with your Cumulocity contact or open a ticket. This btw includes also adding permissions for the new microservices, so that you can do proper A&A.

Rails 3: How To Keep Track of My API Usage?

My app as an API which I have no control of. I don't know which users use it, how many times, etc.
What's the best way of doing an analytics system to keep track of my API usage? Does it need to be a Rack app to filter traffic or there's a better solution for it?
Thanks!
You can create an interface by your self. All you have to do is, trace users by their request to your app and can track records by identifying them by their api key. So a user request to your api will be their usage and so on.