googlearchive / vrview

Library for embedding immersive media into traditional websites.
http://developers.google.com/cardboard/vrview
Apache License 2.0
1.71k stars 1.09k forks source link

IE11 video fallback doesn't work as design. #266

Open andrebonon opened 6 years ago

andrebonon commented 6 years ago

Hi guys,

Looking at the code, I could see that the fallback consists of setting an image and a video at the same time. Example:

var scenes = {
  petra: {
    video: 'congo_2048.mp4', // In this case the video will be render as default.
    image: 'petra.jpg', // In this case it should work as a fallback.
  },
}

BUT, it doesn't work as designed. Currently, it displays an error => 'Both image and video URL can\'t be specified.'

So I propose to remove the checker "if (this.image && this.video) {" from the code below.

SceneInfo.prototype.isValid = function() {
  // Either it's an image or a video.
  if (!this.image && !this.video) {
    this.errorMessage = 'Either image or video URL must be specified.';
    return false;
  }
  if (this.image && this.video) {
    this.errorMessage = 'Both image and video URL can\'t be specified.';
    return false;
  }
  if (this.image && !this.isValidImage_(this.image)) {
    this.errorMessage = 'Invalid image URL: ' + this.image;
    return false;
  }
  this.errorMessage = null;
  return true;
};

I did some tests by removing this piece of code, and it works fine. I'll create a PR.