Skip to content
Prev Previous commit
Next Next commit
update url to src
  • Loading branch information
processprocess committed Mar 21, 2022
commit b7000b03f0393eaad04c81b3185662af5f5c4b4c
12 changes: 6 additions & 6 deletions extensions/amp-video/0.1/test/test-video-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,12 @@ describes.realWin('amp-video cached-sources', {amp: true}, (env) => {
});
});

describe('captions_url field', async () => {
it('should append track element if the cache responds with captions_url', async () => {
describe('captions_src field', async () => {
it('should append track element if the cache responds with captions_src', async () => {
env.sandbox.stub(xhrService, 'fetch').resolves({
json: () =>
Promise.resolve({
'captions_url': 'captions_url_response.vtt',
'captions_src': 'captions_src_response.vtt',
'sources': [
{'url': 'video.mp4', 'bitrate_kbps': 700, 'type': 'video/mp4'},
],
Expand All @@ -516,7 +516,7 @@ describes.realWin('amp-video cached-sources', {amp: true}, (env) => {
env.sandbox.stub(xhrService, 'fetch').resolves({
json: () =>
Promise.resolve({
'captions_url': 'captions_url_response.vtt',
'captions_src': 'captions_src_response.vtt',
'sources': [
{'url': 'video.mp4', 'bitrate_kbps': 700, 'type': 'video/mp4'},
],
Expand All @@ -527,11 +527,11 @@ describes.realWin('amp-video cached-sources', {amp: true}, (env) => {
await fetchCachedSources(videoEl, env.ampdoc);

const trackEl = videoEl.querySelector(
'track[src="captions_url_response.vtt"]'
'track[src="captions_src_response.vtt"]'
);
expect(trackEl).to.not.exist;
});
it('should not append track element if captions_url does not exist', async () => {
it('should not append track element if captions_src does not exist', async () => {
env.sandbox.stub(xhrService, 'fetch').resolves({
json: () =>
Promise.resolve({
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-video/0.1/video-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function fetchCachedSources(
.then((response) => {
applySourcesToVideo(videoEl, response['sources'], maxBitrate);
applyAudioInfoToVideo(videoEl, response['has_audio']);
applyCaptionsTrackToVideo(videoEl, response['captions_url']);
applyCaptionsTrackToVideo(videoEl, response['captions_src']);
})
.catch(() => {
// If cache fails, video should still load properly.
Expand Down