@vkontakte/videoplayer-core 2.0.128-dev.f5e5914a.0 → 2.0.129-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.128-dev.f5e5914a.0",
3
+ "version": "2.0.129-beta.0",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer core library based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -49,7 +49,7 @@
49
49
  "**/*.d.ts"
50
50
  ],
51
51
  "dependencies": {
52
- "@vkontakte/videoplayer-shared": "1.0.56-dev.9b145841.0",
52
+ "@vkontakte/videoplayer-shared": "1.0.57-beta.0",
53
53
  "hls.js": "~1.4.7"
54
54
  }
55
55
  }
@@ -22,7 +22,7 @@ export default class Player implements IPlayer {
22
22
  private wasSetStartedQuality;
23
23
  private desiredState;
24
24
  info: {
25
- playbackState$: ValueSubject<PlaybackState>;
25
+ playbackState$: ValueSubject<PlaybackState | undefined>;
26
26
  position$: ValueSubject<number>;
27
27
  duration$: ValueSubject<number>;
28
28
  muted$: ValueSubject<boolean>;
@@ -47,6 +47,7 @@ export default class Player implements IPlayer {
47
47
  isEnded$: ValueSubject<boolean>;
48
48
  isLooped$: ValueSubject<boolean>;
49
49
  isLive$: ValueSubject<boolean | undefined>;
50
+ isLiveEnded$: ValueSubject<boolean | null>;
50
51
  canChangePlaybackSpeed$: ValueSubject<boolean | undefined>;
51
52
  atLiveEdge$: ValueSubject<boolean | undefined>;
52
53
  atLiveDurationEdge$: ValueSubject<boolean | undefined>;
@@ -207,7 +207,7 @@ export interface IPlayerInfo {
207
207
  * Оптимистичный статут плеера. Так например, значение будет равно Playing сразу после вызова play().
208
208
  * Фактическое состояние лучше отслеживать по событиям (например, playing$)
209
209
  */
210
- playbackState$: IValueObservable<PlaybackState>;
210
+ playbackState$: IValueObservable<PlaybackState | undefined>;
211
211
  /**
212
212
  * Текущая позиция.
213
213
  *
@@ -310,6 +310,10 @@ export interface IPlayerInfo {
310
310
  * Бесконечный ли стрим
311
311
  */
312
312
  isLive$: IValueObservable<boolean | undefined>;
313
+ /**
314
+ * Был ли завершен бесконечный стрим
315
+ */
316
+ isLiveEnded$: IValueObservable<boolean | null>;
313
317
  /**
314
318
  * Доступно ли ускоренное воспроизведении в лайв трансляции
315
319
  */
@@ -3,9 +3,8 @@ import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation, S
3
3
  import { IProvider, IProviderParams } from '../../providers/types';
4
4
  import { TrackHistory } from '../../utils/autoSelectTrack';
5
5
  import { IStateMachine } from '../../utils/StateMachine/types';
6
- import { ISubscription, Milliseconds, ITracer } from '@vkontakte/videoplayer-shared';
6
+ import { ISubscription, ITracer, Milliseconds } from '@vkontakte/videoplayer-shared';
7
7
  import { Player } from './lib/player';
8
- import { ILiveOffset } from '../utils/LiveOffset/types';
9
8
  import { Scene3D } from '../../utils/3d/Scene3D';
10
9
  import DroppedFramesManager from '../../providers/utils/HTMLVideoElement/DroppedFramesManager';
11
10
  import TextTrackManager from '../../providers/utils/HTMLVideoElement/TextTrackManager';
@@ -42,7 +41,6 @@ export default abstract class BaseDashProvider implements IProvider {
42
41
  protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
43
42
  protected videoTrackSwitchHistory: TrackHistory<IVideoTrack>;
44
43
  protected audioTrackSwitchHistory: TrackHistory<import("../../player/types").IBaseTrack>;
45
- protected liveOffset?: ILiveOffset;
46
44
  constructor(params: IParams);
47
45
  protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
48
46
  protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
@@ -1,3 +1,3 @@
1
1
  export declare const DASH_LIVE_UPDATE_INTERVAL_MS = 1000;
2
2
  export declare const DASH_STALL_UPDATE_INTERVAL_MS = 50;
3
- export declare const DASH_LIVE_STALL_REINIT_INTERVAL_MS = 5000;
3
+ export declare const DASH_LIVE_STALL_REINIT_INTERVAL_MS = 2000;
@@ -108,7 +108,7 @@ export declare class BufferManager {
108
108
  private pruneBuffer;
109
109
  private abortBuffer;
110
110
  getDebugBufferState(): IRange<Milliseconds> | undefined;
111
- getForwardBufferDuration(): Milliseconds;
111
+ getForwardBufferDuration(currentPosition?: Milliseconds | undefined): Milliseconds;
112
112
  private detectGaps;
113
113
  private detectGapsWhenIdle;
114
114
  private checkEjectedSegments;
@@ -1,9 +1,9 @@
1
1
  import { HttpConnectionType } from '../../../player/types';
2
- import { CommonInit, Manifest, Representation, StreamKind, TextRepresentation } from './types';
2
+ import { CommonInit, LiveStreamStatus, Manifest, Representation, StreamKind, TextRepresentation } from './types';
3
3
  import StateMachine from '../../../utils/StateMachine/StateMachine';
4
4
  import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
5
5
  import { ITuningConfig } from '../../../utils/tuningConfig';
6
- import { IError, ISubject, ITracer, IValueSubject, Milliseconds, Seconds, Subject } from '@vkontakte/videoplayer-shared';
6
+ import { IError, ISubject, ITracer, IValueSubject, Milliseconds, Subject } from '@vkontakte/videoplayer-shared';
7
7
  export declare enum State {
8
8
  NONE = "none",
9
9
  MANIFEST_READY = "manifest_ready",
@@ -42,11 +42,14 @@ export declare class Player {
42
42
  lastConnectionReused$: IValueSubject<boolean | undefined>;
43
43
  lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
44
44
  currentLiveTextRepresentation$: IValueSubject<TextRepresentation | null>;
45
+ private timeoutSourceOpenId;
45
46
  isLive$: IValueSubject<boolean>;
46
47
  isActiveLive$: IValueSubject<boolean>;
47
48
  isLowLatency$: IValueSubject<boolean>;
48
49
  liveDuration$: IValueSubject<Milliseconds>;
49
- liveAvailabilityStartTime$: IValueSubject<Seconds | undefined>;
50
+ liveSeekableDuration$: IValueSubject<Milliseconds>;
51
+ liveAvailabilityStartTime$: IValueSubject<Milliseconds>;
52
+ liveStreamStatus$: IValueSubject<LiveStreamStatus | undefined>;
50
53
  bufferLength$: IValueSubject<Milliseconds>;
51
54
  liveLatency$: IValueSubject<Milliseconds | undefined>;
52
55
  liveLoadBufferLength$: IValueSubject<Milliseconds>;
@@ -55,14 +58,15 @@ export declare class Player {
55
58
  videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
56
59
  fetcherRecoverableError$: Subject<IError>;
57
60
  fetcherError$: Subject<IError>;
61
+ private liveStreamEndTimestamp;
58
62
  private liveBuffer;
59
63
  private isUpdatingLive;
60
64
  private isJumpGapAfterSeekLive;
61
- private liveLastSeekOffset;
62
65
  private forceEnded$;
63
66
  private gapWatchdogActive;
64
67
  private gapWatchdogSubscription;
65
68
  private stallWatchdogSubscription;
69
+ private livePauseWatchdogSubscription;
66
70
  private destroyController;
67
71
  constructor(params: Params);
68
72
  initManifest: (param_0: HTMLVideoElement, param_1: string, param_2: number) => Promise<void | undefined>;
@@ -72,6 +76,8 @@ export declare class Player {
72
76
  initBuffer(): void;
73
77
  switchRepresentation(kind: StreamKind, id: Representation['id'], dropBuffer?: boolean): Promise<void>;
74
78
  seek(requestedPosition: Milliseconds, forcePrecise: boolean): Promise<void>;
79
+ warmUpMediaSourceIfNeeded(position?: Milliseconds | undefined): void;
80
+ get isStreamEnded(): boolean;
75
81
  stop(): void;
76
82
  setBufferTarget(time: Milliseconds): void;
77
83
  getStreams(): Manifest['streams'] | undefined;
@@ -13,6 +13,11 @@ export declare enum LiveStatus {
13
13
  LiveForwardBuffering = "live_forward_buffering",
14
14
  None = "none"
15
15
  }
16
+ export declare enum LiveStreamStatus {
17
+ Active = "active",
18
+ UnexpectedlyDown = "unexpectedly_down",// Стрим в сети, но трансляция оборвалась из-за тех. проблем
19
+ Unpublished = "unpublished"
20
+ }
16
21
  export declare enum Profile {
17
22
  WEBM_AS_IN_SPEC = "urn:mpeg:dash:profile:webm-on-demand:2012",// Такой указан в спеке
18
23
  WEBM_AS_IN_FFMPEG = "urn:webm:dash:profile:webm-on-demand:2012"
@@ -99,14 +104,20 @@ export interface Stream {
99
104
  mime: string;
100
105
  representations: Representation[];
101
106
  }
107
+ export interface LiveMetadata {
108
+ availabilityStartTime: Milliseconds;
109
+ publishTime: Milliseconds;
110
+ latestSegmentPublishTime: Milliseconds;
111
+ streamIsAlive: boolean;
112
+ streamIsUnpublished: boolean;
113
+ }
102
114
  export interface Manifest {
103
- dynamic: boolean;
104
- liveAvailabilityStartTime: Milliseconds | undefined;
105
115
  duration: Milliseconds | undefined;
106
116
  streams: {
107
117
  [key in StreamKind]: Stream[];
108
118
  };
109
119
  baseUrls: string[];
120
+ live?: LiveMetadata;
110
121
  }
111
122
  export declare enum ProjectionType {
112
123
  RECTANGULAR = 0,
@@ -67,6 +67,7 @@ export interface IProviderOutput {
67
67
  currentBuffer$: IValueSubject<IRange<Seconds> | undefined>;
68
68
  isBuffering$: IValueSubject<boolean>;
69
69
  isLive$: IValueSubject<boolean | undefined>;
70
+ isLiveEnded$: IValueSubject<boolean | null>;
70
71
  isLowLatency$: IValueSubject<boolean | undefined>;
71
72
  liveTime$: IValueSubject<Milliseconds | undefined>;
72
73
  liveBufferTime$: IValueSubject<Milliseconds | undefined>;
@@ -6,6 +6,7 @@ export interface IObservableVideo {
6
6
  canplay$: IObservable<undefined>;
7
7
  ended$: IObservable<undefined>;
8
8
  looped$: IObservable<Seconds>;
9
+ loopExpected$: IObservable<undefined>;
9
10
  error$: IObservable<IError>;
10
11
  seeked$: IObservable<undefined>;
11
12
  seeking$: IObservable<undefined>;
@@ -1,4 +1,4 @@
1
- import { ExactVideoQuality, IObservable, IValueSubject, Milliseconds, Kbps } from '@vkontakte/videoplayer-shared';
1
+ import { ExactVideoQuality, IObservable, IValueSubject, Milliseconds, Kbps, Seconds } from '@vkontakte/videoplayer-shared';
2
2
  import { IVideoTrack } from '../../player/types';
3
3
  import { ITuningConfig } from '../../utils/tuningConfig';
4
4
  interface IConnectData {
@@ -7,6 +7,7 @@ interface IConnectData {
7
7
  rtt$: IValueSubject<Milliseconds>;
8
8
  isBuffering$: IObservable<boolean>;
9
9
  isSeeked$: IObservable<boolean>;
10
+ looped$: IObservable<Seconds>;
10
11
  currentStallDuration$: IObservable<Milliseconds>;
11
12
  qualityLimitsOnStall: ITuningConfig['dash']['qualityLimitsOnStall'];
12
13
  }
@@ -16,7 +16,7 @@ export declare class DeviceChecker implements Checker {
16
16
  get isAndroid(): boolean;
17
17
  get isMobile(): boolean;
18
18
  get iOSVersion(): number | undefined;
19
- detect(): Promise<void>;
19
+ detect(): void;
20
20
  private detectHighEntropyValues;
21
21
  private detectDevice;
22
22
  private detectIOSVersion;
@@ -28,7 +28,6 @@ export declare class VideoChecker implements Checker {
28
28
  private _video;
29
29
  private _deviceChecker;
30
30
  private _browserChecker;
31
- private _webmDecodingInfo;
32
31
  private _protocols;
33
32
  private _containers;
34
33
  private _codecs;
@@ -40,8 +39,7 @@ export declare class VideoChecker implements Checker {
40
39
  get webmDecodingInfo(): Record<WebmFormat, MediaCapabilitiesDecodingInfo> | undefined;
41
40
  get supportedCodecs(): string[];
42
41
  get nativeHlsSupported(): boolean;
43
- detect(): Promise<void>;
44
- private detectWebmDecodingInfo;
42
+ detect(): void;
45
43
  private destroyVideoElement;
46
44
  }
47
45
  export {};
@@ -61,6 +61,7 @@ export type ITuningConfig = {
61
61
  forwardBufferTargetAuto: Milliseconds;
62
62
  forwardBufferTargetManual: Milliseconds;
63
63
  forwardBufferTargetPreload: Milliseconds;
64
+ seekBiasInTheEnd: Milliseconds;
64
65
  maxSegmentDurationLeftToSelectNextSegment: Milliseconds;
65
66
  minSafeBufferThreshold: number;
66
67
  bufferPruningSafeZone: Milliseconds;
@@ -73,11 +74,15 @@ export type ITuningConfig = {
73
74
  useFetchPriorityHints: boolean;
74
75
  qualityLimitsOnStall: {
75
76
  stallDurationNoDataBeforeQualityDecrease: Milliseconds;
77
+ stallDurationToBeCount: Milliseconds;
76
78
  stallCountBeforeQualityDecrease: Milliseconds;
77
79
  resetQualityRestrictionTimeout: Milliseconds;
80
+ ignoreStallsOnSeek: boolean;
78
81
  };
79
82
  enableBaseUrlSupport: boolean;
80
83
  maxSegmentRetryCount: number;
84
+ sourceOpenTimeout: number;
85
+ rejectOnSourceOpenTimeout: boolean;
81
86
  };
82
87
  dashCmafLive: {
83
88
  maxActiveLiveOffset: Milliseconds;
@@ -141,6 +146,7 @@ export type ITuningConfig = {
141
146
  stripRangeHeader: boolean;
142
147
  flushShortLoopedBuffers: boolean;
143
148
  insufficientBufferRuleMargin: Milliseconds;
149
+ seekNearDurationBias: Seconds;
144
150
  dashSeekInSegmentDurationThreshold: Milliseconds;
145
151
  dashSeekInSegmentAlwaysSeekDelta: Milliseconds;
146
152
  endGapTolerance: Milliseconds;