Skip to content

Commit b7954b6

Browse files
authored
✨ [Story Preview] Allow amp-story-360 in preview mode (#38229)
* Enable amp-story-360 and amp-story-captions in preview mode * Create skeleton code for AmpStory360's previewAllowed() * Update AmpStory360.previewAllowed() to allow preview mode as long as video is not being used as the 360 media source * Revert allowing amp-story-captions because ensuring its tracks use cached sources is likely complex
1 parent c830b58 commit b7954b6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

extensions/amp-story-360/0.1/amp-story-360.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,16 @@ class CameraAnimation {
228228
}
229229

230230
export class AmpStory360 extends AMP.BaseElement {
231+
/** @override */
232+
static previewAllowed(element) {
233+
// We can assume that images are cached, but the same is not necessarily
234+
// true for videos. We only allow preview mode for `AmpStory360` when it
235+
// uses cached sources, because requests for origin sources cannot be made
236+
// due to privacy concerns.
237+
const usesVideo = element.querySelector('amp-video');
238+
return !usesVideo;
239+
}
240+
231241
/** @param {!AmpElement} element */
232242
constructor(element) {
233243
super(element);

0 commit comments

Comments
 (0)