Skip to main content
Legend
August 23, 2012
Answered

OSMF with HTTP stream seeking is resetting start index...

  • August 23, 2012
  • 1 reply
  • 4186 views

Hi,

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.

EG:

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.

EG:

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.

But...

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:

NetStream.play(seekPoint);

Rather than:

NetStream.play();

NetStream.seek(seekPoint);

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?

G

    This topic has been closed for replies.
    Correct answer ignatev_me

    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;

    to

    _initialTime = _dvrInfo != null ? _dvrInfo.startTime : (_seekTime > 0 ? _playStart : currentTime);

    2. Change line # 1496

    _initialTime = currentTime

    to

    _initialTime = _seekTime > 0 ? _playStart : currentTime

    That's it!

    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!

    1 reply

    ignatev_meCorrect answer
    Participant
    March 25, 2013

    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;

    to

    _initialTime = _dvrInfo != null ? _dvrInfo.startTime : (_seekTime > 0 ? _playStart : currentTime);

    2. Change line # 1496

    _initialTime = currentTime

    to

    _initialTime = _seekTime > 0 ? _playStart : currentTime

    That's it!

    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!

    Legend
    March 25, 2013

    Thanks, ignatev_me

    G