@@ -937,7 +937,10 @@ export class VideoRTC extends HTMLElement {
|
|||||||
video2.src = 'data:video/mp4;base64,' + VideoRTC.btoa(data);
|
video2.src = 'data:video/mp4;base64,' + VideoRTC.btoa(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.send({ type: 'mp4', value: this.codecs(this.video.canPlayType) });
|
this.send({
|
||||||
|
type: 'mp4',
|
||||||
|
value: this.codecs((type) => this.video.canPlayType(type)),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static btoa(buffer) {
|
static btoa(buffer) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { mock } from 'vitest-mock-extended';
|
||||||
|
|
||||||
import type { VideoRTC } from '../../../../src/components/live/providers/go2rtc/video-rtc';
|
import type { VideoRTC } from '../../../../src/components/live/providers/go2rtc/video-rtc';
|
||||||
import type { RawAdvancedCameraCardConfig } from '../../../../src/config/types';
|
import type { RawAdvancedCameraCardConfig } from '../../../../src/config/types';
|
||||||
@@ -29,4 +30,25 @@ describe('AdvancedCameraCardGo2RTC', () => {
|
|||||||
const player = await card.waitForSelector<VideoRTC>(PLAYER_SELECTOR);
|
const player = await card.waitForSelector<VideoRTC>(PLAYER_SELECTOR);
|
||||||
expect(player.wsURL).toBe('ws://localhost:1984/api/ws?src=office');
|
expect(player.wsURL).toBe('ws://localhost:1984/api/ws?src=office');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should start the modes that follow mp4', async () => {
|
||||||
|
// See: https://github.com/dermotduffy/advanced-camera-card/issues/2721
|
||||||
|
|
||||||
|
const card = await mount({
|
||||||
|
go2rtc: {
|
||||||
|
url: 'http://localhost:1984',
|
||||||
|
stream: 'office',
|
||||||
|
modes: ['mp4', 'webrtc'],
|
||||||
|
},
|
||||||
|
proxy: { live: false },
|
||||||
|
});
|
||||||
|
|
||||||
|
const player = await card.waitForSelector<VideoRTC>(PLAYER_SELECTOR);
|
||||||
|
|
||||||
|
const ws = mock<WebSocket>();
|
||||||
|
player.ws = ws;
|
||||||
|
|
||||||
|
expect(player.onopen()).toEqual(['mp4', 'webrtc']);
|
||||||
|
expect(ws.send).toHaveBeenCalledWith(expect.stringContaining('"type":"mp4"'));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user