Yes this can be done, as @rnrneverdies recommends you can build a plugin to send this data to an analytics aggregator/server. The key here is determining how which backend you which to use. Since Azure Media Player allows you to listen to events, you can easily send the data depending on the back end of your choice.
One type of solution could include sending the data through Azure Service Bus (Event Hubs) using Azure Stream Analytics to view the raw data in blob or table storage, or you can push the data to Power BI for viewing. This is only a single example, and many such analytics services exist allowing you to create a plugin with AMP.
There are several ways to determine the exact time viewed, it just depends on the exact metric you are viewing. For example, you could be looking for the total time watched, or the total unique time watched (which doesn't include overlaps). An example here would be say if you have 5 min content, and the viewer watches the first minute, skips 2 mins then watches the last 2 mins and then decides to watch skip back to the beginning and watch the first 2 mins. With the total time watched this would be 5 mins. For total unique time watched, its 4 mins. Obviously total time watched is a much easier metric to gather here and can be done in a few ways. Here are two such ways that this can be done:
- Use the timeupdate event as a counter for how long the user watched for. For the above example your counter would be at 300.
- Keep track to play, pause, seek, and error events and send time ranges. For the above example you would send {0, 60},{180,300},{0,120}. On the server side you can use this example to filter out overlapping areas so you can get unique times.
As mentioned above, there are many ways to do this, these are just some suggestions.