I was using YouTube videos for my test and I was wondering how can I get the information of bit-rate of the played video?
I used 2 methods to know the information ab
Most YouTube video use adaptive bit rate (ABR) format streaming which means that there is not just a single bit rate.
For ABR multiple bit rate versions of the video are created and each one is broken down into equal length (by time) chunks - e.g. 10 second chunks.
The client player is then able to select the next chunk from the most appropriate bit rate stream for the current network conditions - if the network gets busy it can drop down to a lower bit rate for the next chunk and visa versa if the network is good.
So there is not really the concept of a single bit rate for the whole video, but different bit rates for each chunk that is downloaded (although in practice if you have a good connection it should work up to the top bit rate and stay there).
As you say, you can see a visualisation of this on YouTube by right clicking and looking at the 'stats for nerds' option - see example below:
You can also see the available resolutions, and force the player to select a single one by clicking on the 'wheel' in the bottom right hand corner. As a general rule, a higher resolution will need a higher number of bits and hence mean a higher bit rate,
To see a more detailed view of the video buffers and the bitrate, some players provide a demo view with a representation of the change over time - see below an example from the DASH IF reference player (https://reference.dashif.org/dash.js/latest/samples/dash-if-reference-player/index.html):