Exemplo n.º 1
0
 private void renderSource(DomElement element, WAbstractMedia.Source source, boolean isLast) {
   element.setAttribute("src", resolveRelativeUrl(source.link.getUrl()));
   if (!source.type.equals("")) {
     element.setAttribute("type", source.type);
   }
   if (!source.media.equals("")) {
     element.setAttribute("media", source.media);
   }
   if (isLast && this.alternative_ != null) {
     element.setAttribute(
         "onerror",
         "var media = this.parentNode;if(media){while (media && media.children.length)if (Wt3_2_3.hasTag(media.firstChild,'SOURCE')){media.removeChild(media.firstChild);}else{media.parentNode.insertBefore(media.firstChild, media);}media.style.display= 'none';}");
   } else {
     element.setAttribute("onerror", "");
   }
 }
Exemplo n.º 2
0
 void updateMediaDom(DomElement element, boolean all) {
   if (all && this.alternative_ != null) {
     element.setAttribute(
         "onerror",
         "if(event.target.error && event.target.error.code==event.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED){while (this.hasChildNodes())if (Wt3_2_3.hasTag(this.firstChild,'SOURCE')){this.removeChild(this.firstChild);}else{this.parentNode.insertBefore(this.firstChild, this);}this.style.display= 'none';}");
   }
   if (all || this.flagsChanged_) {
     if (!all || !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Controls).isEmpty()) {
       element.setAttribute(
           "controls",
           !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Controls).isEmpty()
               ? "controls"
               : "");
     }
     if (!all || !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Autoplay).isEmpty()) {
       element.setAttribute(
           "autoplay",
           !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Autoplay).isEmpty()
               ? "autoplay"
               : "");
     }
     if (!all || !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Loop).isEmpty()) {
       element.setAttribute(
           "loop",
           !EnumUtils.mask(this.flags_, WAbstractMedia.Options.Loop).isEmpty() ? "loop" : "");
     }
   }
   if (all || this.preloadChanged_) {
     switch (this.preloadMode_) {
       case PreloadNone:
         element.setAttribute("preload", "none");
         break;
       default:
       case PreloadAuto:
         element.setAttribute("preload", "auto");
         break;
       case PreloadMetadata:
         element.setAttribute("preload", "metadata");
         break;
     }
   }
   this.updateEventSignals(element, all);
   if (all) {
     if (this.alternative_ != null) {
       element.addChild(this.alternative_.createSDomElement(WApplication.getInstance()));
     }
   }
   this.flagsChanged_ = this.preloadChanged_ = false;
 }