Why Bitmovin Player timeShift & maxTimeShift are 0 when isLive equals true?

Hello.

I’m playing stream. player.isLive returns true so I’m sure that it’s live stream.
Im doing

player.timeShift(seconds)

where seconds is for example 10.0, 50.0 etc.

Player skips time but values timeShift and maxTimeShift are still 0 so I don’t know the actual video playback progress

1 Like

Hi @michal.rabinski ,

Thanks for raisin this query. I assume that you are using Bitmovin Android player SDK.
player.timeshift API takes either a negative offset from live edge as input or a UNIX timestamp. Please check the API description in documentation for usage.

Please share following additional information to help us understand issue better?

Another possibility is that the Live window in the stream is too short(< 40 seconds) in which case also player will not show the Live window in player UI as well as not allow seeking. maxTimeshift will also be 0 in this case.

1 Like

Hi @lucky.goyal
THank you for such a quick response.

  • Yes, I’m using android bitmovin sdk
  • Yes I’ve played a lot with samples but there is no example regarding live streams
  • It will be complicated to play my drm content there anyways. I would prefer to discover what I’m doing wrong with my example

The main question is why maxTimeShift is 0

The limit in seconds for time shifting. This value is either negative or 0 and it is always 0 if the active source is not a live stream or there is no active playback session.

In my understanding this value should be negative in case of live stream event when I’m not timeshifting yet.

I’m doing both, timeShift(-20.0) and timeShift(20.0) but now I see that it in fact doesn’t skip video for more that 1 second.

I’m receiving logs such as :

invoke:76: event : TimeShift(position=7.821, target=8.032)

so its skipping about 400ms of time.

I’ve provided value 20.0 so according to docs, it should go to relative time but it’s not working hmmm.

I’m not passing any new LiveConfig so


    /**
     * The minimum buffer depth of a stream needed to enable time shifting. If the available buffer depth is shorter,
     * time shifting is disabled and [Player.maxTimeShift] returns 0.
     *
     * Default value is [DEFAULT_MIN_TIME_SHIFT_BUFFER_DEPTH].
     */
    var minTimeShiftBufferDepth: Double = DEFAULT_MIN_TIME_SHIFT_BUFFER_DEPTH

isn’t overriden or anything.

1 Like

thanks @michal.rabinski , let’s please go step by step and focus on one thing at a time. First thing that we need to check is the live window size in the tested stream. If the window size is less than 40 seconds, then as per default behaviour maxTimeShit will also be 0 even for Live stream. The below statement indicates that it can be 0 or negative for Live but for VOD it is always zero. Can you please check a snapshot of HLS or DASH Manifest file? For HLS, you will need to check the variant HLS file. We need to check the duration of audio/video segments in the DASH MPD or HLS variant M3U8 file.

The limit in seconds for time shifting. This value is either negative or 0 and it is always 0 if the active source is not a live stream or there is no active playback session.

1 Like

Okay

#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="AACL",NAME="audio_483_eng",LANGUAGE="eng",DEFAULT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="AACL",NAME="audio_482_deu",LANGUAGE="deu",DEFAULT=NO,CHANNELS="2",URI="<confidential>.m3u8/Alter-audio_482_deu(482)"
#EXT-X-STREAM-INF:BANDWIDTH=3200000,CODECS="mp4a.40.2,avc1.640020",RESOLUTION=1280x720,FRAME-RATE=50,AUDIO="AACL"
<confidential>.m3u8/Level(2)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=169801,CODECS="avc1.640020",RESOLUTION=1280x720,URI="<confidential>.m3u8/Iframe(2)"
#EXT-X-STREAM-INF:BANDWIDTH=1000000,CODECS="mp4a.40.2,avc1.4d401e",RESOLUTION=768x432,FRAME-RATE=25,AUDIO="AACL"
<confidential>.m3u8/Level(1)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=114078,CODECS="avc1.4d401e",RESOLUTION=768x432,URI="<confidential>.m3u8/Iframe(1)"
#EXT-X-STREAM-INF:BANDWIDTH=7200000,CODECS="mp4a.40.2,avc1.64002a",RESOLUTION=1920x1080,FRAME-RATE=50,AUDIO="AACL"
<confidential>.m3u8/Level(3)
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=305236,CODECS="avc1.64002a",RESOLUTION=1920x1080,URI="<confidential>.m3u8/Iframe(3)"
#EXT-X-STREAM-INF:BANDWIDTH=96000,CODECS="mp4a.40.2",AUDIO="AACL"
<confidential>.m3u8/Level(4)

I have something like that, is it what we are looking for ?

1 Like

@michal.rabinski . Yes, but this the Master HLS manifest which provides URLs of the audio and video variant manifests/playlists. Can you download one of the variant manifests URLs like confidential.m3u8/Level(2) or confidential.m3u8/Level(1) etc. and share that?

Easiest would be if you can share the HLS stream URL (but not DRM config) for now. I can have a quick look at the Manifest and check the window depth. If not, here is a reference of what you should find in variant Manifest. This should give a list of audio/video segments with duration of each segment. You can add up duration value(#EXTINF: value) of all segments and that will be the live window duration. For example in below sample, there are 10 segments of approx. 6 seconds each totalling to 60 seconds window duration. Please also note that for Live HLS, there should NOT be a #EXT-X-ENDLIST tag at the end of the manifest/playlist file. Hope this helps.

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:17025361
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:41:28.260Z
#EXTINF:6.006,
master_11_17025361.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:41:34.266Z
#EXTINF:6.006,
master_11_17025362.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:41:40.272Z
#EXTINF:6.006,
master_11_17025363.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:41:46.278Z
#EXTINF:6.006,
master_11_17025364.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:41:52.284Z
#EXTINF:6.006,
master_11_17025365.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:41:58.290Z
#EXTINF:6.006,
master_11_17025366.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:42:04.296Z
#EXTINF:6.006,
master_11_17025367.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:42:10.302Z
#EXTINF:6.006,
master_11_17025368.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:42:16.308Z
#EXTINF:6.006,
master_11_17025369.ts?m=1657037689
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:42:22.314Z
#EXTINF:6.006,
master_11_17025370.ts?m=1657037689

1 Like

Ok
Level(1)

#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:4
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:52:14.000Z
#EXT-X-MEDIA-SEQUENCE:366
#EXTINF:4,
Level(1)/Segment(366).ts
#EXTINF:4,
Level(1)/Segment(367).ts
#EXTINF:4,
Level(1)/Segment(368).ts
#EXTINF:4,
Level(1)/Segment(369).ts

Level(2)

#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:4
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:52:18.000Z
#EXT-X-MEDIA-SEQUENCE:367
#EXTINF:4,
Level(2)/Segment(367).ts
#EXTINF:4,
Level(2)/Segment(368).ts
#EXTINF:4,
Level(2)/Segment(369).ts
#EXTINF:4,
Level(2)/Segment(370).ts

Level(3)

#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:4
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:52:22.000Z
#EXT-X-MEDIA-SEQUENCE:368
#EXTINF:4,
Level(3)/Segment(368).ts
#EXTINF:4,
Level(3)/Segment(369).ts
#EXTINF:4,
Level(3)/Segment(370).ts
#EXTINF:4,
Level(3)/Segment(371).ts

Level(4)

#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:4
#EXT-X-PROGRAM-DATE-TIME:2022-09-07T13:52:22.000Z
#EXT-X-MEDIA-SEQUENCE:368
#EXTINF:4,
Level(4)/Segment(368).aac
#EXTINF:4,
Level(4)/Segment(369).aac
#EXTINF:4,
Level(4)/Segment(370).aac
#EXTINF:4,
Level(4)/Segment(371).aac

Iframe(1)

#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:4
#EXT-X-MEDIA-SEQUENCE:351
#EXT-X-I-FRAMES-ONLY
#EXT-X-MAP:URI="Iframe(1)/ISeg(2).ts",BYTERANGE="376@188"
#EXTINF:2,
#EXT-X-BYTERANGE:25756@391539140
Iframe(1)/Seg(2).ts
#EXTINF:2,
#EXT-X-BYTERANGE:66176@391941084
Iframe(1)/Seg(2).ts
#EXTINF:2,
#EXT-X-BYTERANGE:61664@392324416
Iframe(1)/Seg(2).ts
#EXTINF:2,
#EXT-X-BYTERANGE:35720@392706056
Iframe(1)/Seg(2).ts
#EXTINF:2,
#EXT-X-BYTERANGE:21432@393002344
Iframe(1)/Seg(2).ts
#EXTINF:2,
#EXT-X-BYTERANGE:21056@393254076
Iframe(1)/Seg(2).ts
#EXTINF:2,
#EXT-X-BYTERANGE:27636@393535888
Iframe(1)/Seg(2).ts
#EXTINF:2,
#EXT-X-BYTERANGE:23124@393925424
Iframe(1)/Seg(2).ts

So for example for Level(1)
366+367+368+369 = 1470 seconds time window
So I should be able to skip 1470 seconds max yes ?

1 Like

great.

So for example for Level(1)
366+367+368+369 = 1470 seconds time window
So I should be able to skip 1470 seconds max yes ?

No, each variant playlist have same number (4) segments of 4 seconds each. So the live window A.K.A DVR window duration is 4x4=16 seconds only. The value #EXT-X-MEDIA-SEQUENCE:366 represents the sequence number of first segment and is not related to live window size. Since the live window duration is only 16 seconds which is < 40 seconds threshold, so player returns maxTimeShift=0 and also why timeshift will not work. This is expected player behaviour. With Bitmovin player UI, you should also not see any progress bar as seeking/timeshifting is not possible in live window shorter than 40 seconds.

1 Like

Okay, so everything is normal and I should try with other live streams ( I have a bunch of them ) and if those values are correct then timeshifting should work and I will tell it when checking maxTimeShift if it’s not 0 yes ?

1 Like

OK I checked another stream and maxShift time is different than 0.
Thank you @lucky.goyal for your help. Now I’m more knowledgeable :wink:

Regards

Michal

1 Like

Great, glad to help. Please note that the player.timeshift(negative_offset_from_end) takes negative offset as param. This negative offset is from end/edge of the live stream. For example passing -30 means that player will timeshift to a point 30 seconds behind the live edge.

If you pass a positive offset, the behaviour could be undefined. The positive value as mentioned in documentation is absolute UNIX timestamp and not an offset from start of the live stream.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.