feat: Add experimental rewrite of go2rtc live provider (MSE/WebRTC/MP4/MJPEG) (#2580)
- Closes #2556 - Closes #2450 **Key intended features:** - go2rtc compatible - 100% test coverage to significantly improve ability to test, maintain and work around browser weirdnesses (e.g. Safari). - Written from the ground up in the style of the rest of the project. **To use:** - Change `live_provider` from `go2rtc` to `go2rtc-experimental`.
This commit is contained in:
@@ -2,12 +2,14 @@ import { expect, it, vi } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { PauseAction } from '../../../../src/card-controller/actions/actions/pause';
|
||||
import type { MediaPlayerController } from '../../../../src/types';
|
||||
import type { MediaPlayerController, PlaybackControl } from '../../../../src/types';
|
||||
import { createCardAPI, createMediaLoadedInfo } from '../../../test-utils';
|
||||
|
||||
it('should handle pause action', async () => {
|
||||
const api = createCardAPI();
|
||||
const mediaPlayerController = mock<MediaPlayerController>();
|
||||
const mediaPlayerController = mock<MediaPlayerController>({
|
||||
playback: mock<PlaybackControl>(),
|
||||
});
|
||||
vi.mocked(api.getMediaLoadedInfoManager().get).mockReturnValue(
|
||||
createMediaLoadedInfo({
|
||||
mediaPlayerController,
|
||||
@@ -23,5 +25,5 @@ it('should handle pause action', async () => {
|
||||
|
||||
await action.execute(api);
|
||||
|
||||
expect(mediaPlayerController.pause).toBeCalled();
|
||||
expect(mediaPlayerController.playback?.pause).toBeCalled();
|
||||
});
|
||||
|
||||
@@ -2,12 +2,14 @@ import { expect, it, vi } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { PlayAction } from '../../../../src/card-controller/actions/actions/play';
|
||||
import type { MediaPlayerController } from '../../../../src/types';
|
||||
import type { MediaPlayerController, PlaybackControl } from '../../../../src/types';
|
||||
import { createCardAPI, createMediaLoadedInfo } from '../../../test-utils';
|
||||
|
||||
it('should handle play action', async () => {
|
||||
const api = createCardAPI();
|
||||
const mediaPlayerController = mock<MediaPlayerController>();
|
||||
const mediaPlayerController = mock<MediaPlayerController>({
|
||||
playback: mock<PlaybackControl>(),
|
||||
});
|
||||
vi.mocked(api.getMediaLoadedInfoManager().get).mockReturnValue(
|
||||
createMediaLoadedInfo({
|
||||
mediaPlayerController,
|
||||
@@ -23,5 +25,5 @@ it('should handle play action', async () => {
|
||||
|
||||
await action.execute(api);
|
||||
|
||||
expect(mediaPlayerController.play).toBeCalled();
|
||||
expect(mediaPlayerController.playback?.play).toBeCalled();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user