I have built an OSMF player that allows users to seek to where they were when resuming, but also to scrub back to the beginning.
A stream is 1 minute long.
User starts play at 25 seconds.
User can scrub back to 5 seconds or forward to 55 seconds.
This works perfectly with RTMP - TimeTrait reports correctly and video displays correctly.
Start at 25 seconds, TimeTrait reports: duration = 60, current position = 25 and displaying video is 25.
Seek to 5 seconds rewinds to current duration = 60, position = 5, displaying video is 5.
With HTTP streams...
Start at 25 seconds. TimeTrait reports: duration = 60, current position = 25 and displaying video is 50.
Seek to 5 seconds rewinds to before the start of the stream and gives me a media complete... end of stream.
Start at 30 seconds, TimeTrait reports duration = 60, current position = 30 and displaying video is 60 so gives me a media complete... end of stream.
It is pretty clear that what is happening is that HTTP stream seeking is resetting my start index to the seek point, as if I had started play with:
This, I hasten to add, is a horrendous issue from my client's point of view as it effectively means I cannot allow resume of content.
Does anybody have any ideas, workarounds?
After digging into OSMF code i've found a SOLUTION:
First, ensure that you have the latest OSMF source inside your project.
For now it's 2.0.71 (org.osmf.utils.Version).
Navigate to org.osmf.net.httpstreaming.HTTPNetStream
and make some changes:
1. Change line # 1441
_initialTime = _dvrInfo != null ? _dvrInfo.startTime : currentTime;
_initialTime = _dvrInfo != null ? _dvrInfo.startTime : (_seekTime > 0 ? _playStart : currentTime);
2. Change line # 1496
_initialTime = currentTime
_initialTime = _seekTime > 0 ? _playStart : currentTime
Now you can listen to MediaPlayerCapabilityChangeEvent.CAN_SEEK_CHANGE event
and seek immediately.
By the way: if you'll find any bugs related to this change feel free to post them here!
opensourcemediaframework.com is now gone and it looks like Adobe is gone in regards to OSMF as well. http://www.osmf.org is dead also, so so much for Open Source I guess. Too bad I trusted Adobe and too bad for my client that built a business model based on Adobe technology :-/
Anyone knows where I can find source code from versions beyone 2.0? Like the 2.0.71 version mentioned above in this thread?
Sure, but did you look at that site? Tons of dead links and the SourceForge repo was last updated for the 2.0 launch almost 1.5 years ago. In other words - not a single bug fix in two years?
I've found a couple Github repositories that seem to have taken over where Adobe dropped the ball though. Will try my luck there.