Fix for #2895
Created by: oldmtn
// Issue Description You can see when it playback at 02:00, and try to switch to next period. The player will always buffering and won't try to download next fragment.
// Solution onEnd will change active stream while onStreamCanLoadNext won't. So if we call getNextStream in onEnd, we will get next period. And thus call getNextStream in onStreamCanLoadNext will get next, next period. Which will prevent the schedule to download fragment nearby currentTime.
To fix the issue, I think it should call onStreamCanLoadNext first then call onEnd.