I've been working with OSMF for a few months now and I've recently noticed some interesting behavior regarding the trait process. It seems that with a live stream, the getTraitOrThrow() method get's fired every MediaPlayer.currentTimeUpdateInterval with traitType of "load". I understand the reason for it being that it's trying to calculate bytesLoaded. bytesLoaded however is always 0, as is bytesTotal. Therefore it seems to me like the load trait should be removed. Is this a feasible operation or will it affect a player in an adverse way?
In MediaPlayer.onBytesLoadedTimer(), would it be acceptable to add this line at the very end?
I tried it and it seemed to work, however i very limited insight as to the implications of this.
The LoadTrait is used for most than just the byte counts, it's also used for loading and unloading the media. If we were to remove it, then any attempt to unload the media would fail. (Unloading isn't explicitly exposed by the MediaPlayer, but you can call unload() directly on the LoadTrait.)
Note that bytesLoaded/bytesTotal will only have non-zero values for media that have bytes to transfer, where the byte transfer may need to be communicated to the user (e.g. display download progress in the scrub bar). For some media types (like streaming video), such a display wouldn't be useful/necessary.