BeamerReveal

 view release on metacpan or  search on metacpan

lib/BeamerReveal/Object/BeamerFrame.pm  view on Meta::CPAN

    exists $self->{parameters}->{embed} or exists $presentation->{parameters}->{embed};
  
  ###############################################
  # process all video material / can be embedded
  foreach my $video (@{$self->{videos}}) {
    my %commonStamps = ( X => _topercent( $video->{x} ),
			 Y => _topercent( $video->{y} ),
			 W => _topercent( $video->{width} ),
			 H => _topercent( $video->{height} ),
			 VIDEOID          => 'embedded-id-' . $embeddedID++,
			 VIDEOEMBEDDEDB64 => $videoContent,
			 MIMETYPE         => $mimeType,
			 FIT => $video->{fit},
			 AUTOPLAY => exists $video->{autoplay} ? 'data-autoplay' : '',
			 CONTROLS => exists $video->{controls} ? 'controls' : '',
			 MUTED => exists $video->{muted} ? 'muted' : '',
			 LOOP => exists $video->{loop} ? 'loop' : '',
		       );
    my $vStamps;
    my $vTemplate;
    if ( exists $video->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded video" );
      $vTemplate = $templateStore->fetch( 'html', 'video-embedded.html' );
      my ( $mimeType ) = $mediaManager->videoFromStore( $video->{file},
							to_embed => 1 );
      $vStamps = { %commonStamps,
		   VIDEOID          => 'embedded-id-' . $embeddedID++,
		   VIDEOEMBEDDEDB64 => $videoContent,
		   MIMETYPE         => $mimeType,
		 };
    } else {
      $logger->log( 4, "- adding video" );
      $vTemplate = $templateStore->fetch( 'html', 'video.html' );
      my $videoFile;
      if ( $video->{file} =~ /^https?:\/\// ) {
	$videoFile = $video->{file};
      }
      else {

lib/BeamerReveal/Object/BeamerFrame.pm  view on Meta::CPAN

	( $mimeType, $audioContent ) =
	  $mediaManager->voiceoverFromStore( $generatedContent->{voiceovers}->[$voCounter++],
					     to_embed => 1 );
      }
      else {
	( $mimeType, $audioContent ) = $mediaManager->audioFromStore( $audio->{file},
								      to_embed => 1 );
      }
      $aStamps = { %commonStamps,
		   AUDIOID          => 'embedded-id-' . $embeddedID++,
		   AUDIOEMBEDDEDB64 => $audioContent,
		   MIMETYPE         => $mimeType,
		 };
    } else {
      $logger->log( 4, "- adding audio" );
      $aTemplate = $templateStore->fetch( 'html', 'audio.html' );
      my $audioFile;
      if ( $audio->{file} =~ /^https?:\/\// ) {
	$audioFile = $audio->{file};
      }
      else {

lib/BeamerReveal/Object/BeamerFrame.pm  view on Meta::CPAN

  }

  ###############################################
  # process all image material / can be embedded
  foreach my $image (@{$self->{images}}) {
    my %commonStamps = ( X => _topercent( $image->{x} ),
			 Y => _topercent( $image->{y} ),
			 W => _topercent( $image->{width} ),
			 H => _topercent( $image->{height} ),
			 IMAGEID          => 'embedded-id-' . $embeddedID++,
			 IMAGEEMBEDDEDB64 => $imageContent,
			 MIMETYPE         => $mimeType,
			 FIT              => $image->{fit}
		       );
    my $iStamps;
    my $iTemplate;
    if ( exists $image->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded image" );
      $iTemplate = $templateStore->fetch( 'html', 'image-embedded.html' );
      my( $mimeType, $imageContent ) = $mediaManager->imageFromStore( $image->{file},
								      to_embed => 1 );
      $iStamps = { %commonStamps,
		   IMAGEID          => 'embedded-id-' . $embeddedID++,
		   IMAGEEMBEDDEDB64 => $imageContent,
		   MIMETYPE         => $mimeType,
		 };
    } else {
      $logger->log( 4, "- adding image" );
      $iTemplate = $templateStore->fetch( 'html', 'image.html' );
      my $imageFile;
      if ( $image->{file} =~ /^https?:\/\// ) {
	$imageFile = $image->{file};
      }
      else {

lib/BeamerReveal/Object/BeamerFrame.pm  view on Meta::CPAN

		       );
    my $iStamps;
    my $iTemplate;
    if ( exists $iframe->{embed} or exists $presentation->{parameters}->{embed} ) {
      $logger->log( 4, "- adding embedded iframe" );
      $iTemplate = $templateStore->fetch( 'html', 'iframe-embedded.html' );
      my ( $mimeType, $iframeContent ) = $mediaManager->iframeFromStore( $iframe->{file},
									 to_embed => 1 );
      $iStamps = { %commonStamps,
		   IFRAMEID          => 'embedded-id-' . $embeddedID++,
		   IFRAMEEMBEDDEDB64 => $iframeContent,
		 };
    } else {
      $logger->log( 4, "- adding iframe" );
      $iTemplate = $templateStore->fetch( 'html', 'iframe.html' );
      my $iframeFile;
      if ( $iframe->{file} =~ /^https?:\/\// ) {
	$iframeFile = $iframe->{file};
      }
      else {
	( undef, $iframeFile ) = $mediaManager->iframeFromStore( $iframe->{file} );

lib/BeamerReveal/Object/BeamerFrame.pm  view on Meta::CPAN

    if ( exists $animation->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded animation" );
      $aTemplate = $templateStore->fetch( 'html', 'animation-embedded.html' );
      my ( $mimeType, $videoContent ) =
	$mediaManager->animationFromStore( $generatedContent->{animations}->[$aCounter++],
					   to_embed => 1 );
      $aStamps =
	{
	 %commonStamps,
	 ANIMATIONID          => 'embedded-id-' . $embeddedID++,
	 ANIMATIONEMBEDDEDB64 => $videoContent,
	 MIMETYPE             => $mimeType,
	 FIT                  => $image->{fit}
	};
    }
    else {
      $logger->log( 4, "- adding animation: " . $generatedContent->{animations}->[$aCounter] );
      $aTemplate = $templateStore->fetch( 'html', 'animation.html' );
      my ( $undef, $file ) =
	$mediaManager->animationFromStore( $generatedContent->{animations}->[$aCounter++] );
      

lib/BeamerReveal/Object/BeamerFrame.pm  view on Meta::CPAN

    if ( exists $still->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded still" );
      $sTemplate = $templateStore->fetch( 'html', 'still-embedded.html' );
      my ( $mimeType, $videoContent ) =
	$mediaManager->stillFromStore( $generatedContent->{stills}->[$sCounter++],
				       to_embed => 1 );
      $sStamps =
	{
	 %commonStamps,
	 STILLID          => 'embedded-id-' . $embeddedID++,
	 STILLEMBEDDEDB64 => $videoContent,
	 MIMETYPE         => $mimeType,
	 FIT              => $image->{fit}
	};
    }
    else {
      $logger->log( 4, "- adding still: " . $generatedContent->{stills}->[$sCounter] );
      $sTemplate = $templateStore->fetch( 'html', 'still.html' );
      my ( undef, $file ) =
	$mediaManager->stillFromStore( $generatedContent->{stills}->[$sCounter++] );

lib/BeamerReveal/Object/BeamerFrame.pm  view on Meta::CPAN

    if ( $slideEmbed ) {
      my $nTemplate = $templateStore->fetch( 'html', 'note-embedded.html' );
      
      # remember: the hasnote entry holds the note number
      my ( $mimeType, $notesImage ) = $mediaManager->noteFromStore( $self->{hasnotes},
								to_embed => 1 );
      
      my $nStamps =
	{
	 NOTEID          => 'embedded-id-' . $embeddedID++,
	 NOTEEMBEDDEDB64 => $notesImage,	
	 MIMETYPE        => $mimeType,
	};
      
      $notes = BeamerReveal::TemplateStore::stampTemplate( $nTemplate, $nStamps );
    }
    else {
      my $nTemplate = $templateStore->fetch( 'html', 'note.html' );
      
      # remember: the hasnote entry holds the note number
      my ( undef, $notesImage ) = $mediaManager->noteFromStore( $self->{hasnotes} );

lib/BeamerReveal/Object/BeamerFrame.pm  view on Meta::CPAN

  # generate slide itself
  if ( $slideEmbed ) {
    my $fTemplate = $templateStore->fetch( 'html', 'beamerframe-embedded.html' );
    
    my ( $mimeType, $slideImage ) = $mediaManager->slideFromStore( $self->{parameters}->{rawpage},
								   to_embed => 1 );
    my $fStamps =
      {
       DATAMENUTITLE    => $menuTitle,
       SLIDEID          => 'embedded-id-' . $embeddedID++,
       SLIDEEMBEDDEDB64 => $slideImage,
       MIMETYPE         => $mimeType,
       SLIDECONTENT     => $content,
       TRANSITION       => $self->{parameters}->{transition} || 'fade',
       AUTOSLIDE        => $autoSlide,
       NOTESIMAGE       => $notes
      };
    
    return BeamerReveal::TemplateStore::stampTemplate( $fTemplate, $fStamps );
    
  } else {

lib/BeamerReveal/Object/BeamerFrame.pm~  view on Meta::CPAN

    exists $self->{parameters}->{embed} or exists $presentation->{parameters}->{embed};
  
  ###############################################
  # process all video material / can be embedded
  foreach my $video (@{$self->{videos}}) {
    my %commonStamps = ( X => _topercent( $video->{x} ),
			 Y => _topercent( $video->{y} ),
			 W => _topercent( $video->{width} ),
			 H => _topercent( $video->{height} ),
			 VIDEOID          => 'embedded-id-' . $embeddedID++,
			 VIDEOEMBEDDEDB64 => $videoContent,
			 MIMETYPE         => $mimeType,
			 FIT => $video->{fit},
			 AUTOPLAY => exists $video->{autoplay} ? 'data-autoplay' : '',
			 CONTROLS => exists $video->{controls} ? 'controls' : '',
			 MUTED => exists $video->{muted} ? 'muted' : '',
			 LOOP => exists $video->{loop} ? 'loop' : '',
		       );
    my $vStamps;
    my $vTemplate;
    if ( exists $video->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded video" );
      $vTemplate = $templateStore->fetch( 'html', 'video-embedded.html' );
      my ( $mimeType ) = $mediaManager->videoFromStore( $video->{file},
							to_embed => 1 );
      $vStamps = { %commonStamps,
		   VIDEOID          => 'embedded-id-' . $embeddedID++,
		   VIDEOEMBEDDEDB64 => $videoContent,
		   MIMETYPE         => $mimeType,
		 };
    } else {
      $logger->log( 4, "- adding video" );
      $vTemplate = $templateStore->fetch( 'html', 'video.html' );
      my $videoFile;
      if ( $video->{file} =~ /^https?:\/\// ) {
	$videoFile = $video->{file};
      }
      else {

lib/BeamerReveal/Object/BeamerFrame.pm~  view on Meta::CPAN


    #!!! WDSC: if a file starts with voiceover-, you need to look it up in the voiceovers section!
    
    if ( exists $audio->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded audio" );
      $aTemplate = $templateStore->fetch( 'html', 'audio-embedded.html' );
      my ( $mimeType, $audioContent ) = $mediaManager->audioFromStore( $audio->{file},
								       to_embed => 1 );
      $aStamps = { %commonStamps,
		   AUDIOID          => 'embedded-id-' . $embeddedID++,
		   AUDIOEMBEDDEDB64 => $audioContent,
		   MIMETYPE         => $mimeType,
		 };
    } else {
      $logger->log( 4, "- adding audio" );
      $aTemplate = $templateStore->fetch( 'html', 'audio.html' );
      my $audioFile;
      if ( $audio->{file} =~ /^https?:\/\// ) {
	$audioFile = $audio->{file};
      }
      else {

lib/BeamerReveal/Object/BeamerFrame.pm~  view on Meta::CPAN

  }

  ###############################################
  # process all image material / can be embedded
  foreach my $image (@{$self->{images}}) {
    my %commonStamps = ( X => _topercent( $image->{x} ),
			 Y => _topercent( $image->{y} ),
			 W => _topercent( $image->{width} ),
			 H => _topercent( $image->{height} ),
			 IMAGEID          => 'embedded-id-' . $embeddedID++,
			 IMAGEEMBEDDEDB64 => $imageContent,
			 MIMETYPE         => $mimeType,
			 FIT              => $image->{fit}
		       );
    my $iStamps;
    my $iTemplate;
    if ( exists $image->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded image" );
      $iTemplate = $templateStore->fetch( 'html', 'image-embedded.html' );
      my( $mimeType, $imageContent ) = $mediaManager->imageFromStore( $image->{file},
								      to_embed => 1 );
      $iStamps = { %commonStamps,
		   IMAGEID          => 'embedded-id-' . $embeddedID++,
		   IMAGEEMBEDDEDB64 => $imageContent,
		   MIMETYPE         => $mimeType,
		 };
    } else {
      $logger->log( 4, "- adding image" );
      $iTemplate = $templateStore->fetch( 'html', 'image.html' );
      my $imageFile;
      if ( $image->{file} =~ /^https?:\/\// ) {
	$imageFile = $image->{file};
      }
      else {

lib/BeamerReveal/Object/BeamerFrame.pm~  view on Meta::CPAN

		       );
    my $iStamps;
    my $iTemplate;
    if ( exists $iframe->{embed} or exists $presentation->{parameters}->{embed} ) {
      $logger->log( 4, "- adding embedded iframe" );
      $iTemplate = $templateStore->fetch( 'html', 'iframe-embedded.html' );
      my ( $mimeType, $iframeContent ) = $mediaManager->iframeFromStore( $iframe->{file},
									 to_embed => 1 );
      $iStamps = { %commonStamps,
		   IFRAMEID          => 'embedded-id-' . $embeddedID++,
		   IFRAMEEMBEDDEDB64 => $iframeContent,
		 };
    } else {
      $logger->log( 4, "- adding iframe" );
      $iTemplate = $templateStore->fetch( 'html', 'iframe.html' );
      my $iframeFile;
      if ( $iframe->{file} =~ /^https?:\/\// ) {
	$iframeFile = $iframe->{file};
      }
      else {
	( undef, $iframeFile ) = $mediaManager->iframeFromStore( $iframe->{file} );

lib/BeamerReveal/Object/BeamerFrame.pm~  view on Meta::CPAN

    if ( exists $animation->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded animation" );
      $aTemplate = $templateStore->fetch( 'html', 'animation-embedded.html' );
      my ( $mimeType, $videoContent ) =
	$mediaManager->animationFromStore( $generatedContent->{animations}->[$aCounter++],
				      to_embed => 1 );
      $aStamps =
	{
	 %commonStamps,
	 ANIMATIONID          => 'embedded-id-' . $embeddedID++,
	 ANIMATIONEMBEDDEDB64 => $videoContent,
	 MIMETYPE             => $mimeType,
	 FIT                  => $image->{fit}
	};
    }
    else {
      $logger->log( 4, "- adding animation: " . $generatedContent->{animations}->[$aCounter] );
      $aTemplate = $templateStore->fetch( 'html', 'animation.html' );
      my ( $undef, $file ) =
	$mediaManager->animationFromStore( $generatedContent->{animations}->[$aCounter++] );
      

lib/BeamerReveal/Object/BeamerFrame.pm~  view on Meta::CPAN

    if ( exists $still->{embed} or $slideEmbed ) {
      $logger->log( 4, "- adding embedded still" );
      $sTemplate = $templateStore->fetch( 'html', 'still-embedded.html' );
      my ( $mimeType, $videoContent ) =
	$mediaManager->stillFromStore( $generatedContent->{stills}->[$sCounter++],
				       to_embed => 1 );
      $sStamps =
	{
	 %commonStamps,
	 STILLID          => 'embedded-id-' . $embeddedID++,
	 STILLEMBEDDEDB64 => $videoContent,
	 MIMETYPE         => $mimeType,
	 FIT              => $image->{fit}
	};
    }
    else {
      $logger->log( 4, "- adding still: " . $generatedContent->{stills}->[$sCounter] );
      $sTemplate = $templateStore->fetch( 'html', 'still.html' );
      my ( undef, $file ) =
	$mediaManager->stillFromStore( $generatedContent->{stills}->[$sCounter++] );

lib/BeamerReveal/Object/BeamerFrame.pm~  view on Meta::CPAN

    if ( $slideEmbed ) {
      my $nTemplate = $templateStore->fetch( 'html', 'note-embedded.html' );
      
      # remember: the hasnote entry holds the note number
      my ( $mimeType, $notesImage ) = $mediaManager->noteFromStore( $self->{hasnotes},
								to_embed => 1 );
      
      my $nStamps =
	{
	 NOTEID          => 'embedded-id-' . $embeddedID++,
	 NOTEEMBEDDEDB64 => $notesImage,	
	 MIMETYPE        => $mimeType,
	};
      
      $notes = BeamerReveal::TemplateStore::stampTemplate( $nTemplate, $nStamps );
    }
    else {
      my $nTemplate = $templateStore->fetch( 'html', 'note.html' );
      
      # remember: the hasnote entry holds the note number
      my ( undef, $notesImage ) = $mediaManager->noteFromStore( $self->{hasnotes} );

lib/BeamerReveal/Object/BeamerFrame.pm~  view on Meta::CPAN

  # generate slide itself
  if ( $slideEmbed ) {
    my $fTemplate = $templateStore->fetch( 'html', 'beamerframe-embedded.html' );
    
    my ( $mimeType, $slideImage ) = $mediaManager->slideFromStore( $self->{parameters}->{rawpage},
								   to_embed => 1 );
    my $fStamps =
      {
       DATAMENUTITLE    => $menuTitle,
       SLIDEID          => 'embedded-id-' . $embeddedID++,
       SLIDEEMBEDDEDB64 => $slideImage,
       MIMETYPE         => $mimeType,
       SLIDECONTENT     => $content,
       TRANSITION       => $self->{parameters}->{transition} || 'fade',
       AUTOSLIDE        => $autoSlide,
       NOTESIMAGE       => $notes
      };
    
    return BeamerReveal::TemplateStore::stampTemplate( $fTemplate, $fStamps );
    
  } else {

share/templates/html/animation-embedded.html  view on Meta::CPAN

			     height: 100%;
			     ">
  <video id="---ANIMATIONID---"
	 ---AUTOPLAY--- ---CONTROLS--- muted ---LOOP---
	 style="width: ---W---;
		height: ---H---;
 		object-fit: ---FIT---;
		"></video>
  <script type="module">
    const encoded = `
---ANIMATIONEMBEDDEDB64---`;
    const bytes = Uint8Array.from(atob(encoded), c =>c.charCodeAt(0));
    const blob = new Blob([bytes], { type: "---MIMETYPE---" });
    const animation = document.getElementById("---ANIMATIONID---");
    animation.src = URL.createObjectURL(blob);
  </script>
</div>

share/templates/html/audio-embedded.html  view on Meta::CPAN

			     height: 100%;
			     ">
  <audio id="---AUDIOID---"
	 ---AUTOPLAY--- ---CONTROLS--- ---LOOP---
	 style="width: ---W---;
		height: ---H---;
 		object-fit: ---FIT---;
		"></audio>
  <script type="module">
    const encoded = `
---AUDIOEMBEDDEDB64---`;
    const bytes = Uint8Array.from(atob(encoded), c =>c.charCodeAt(0));
    const blob = new Blob([bytes], { type: "---MIMETYPE---" });
    
    const audio = document.getElementById("---AUDIOID---");
    audio.src = URL.createObjectURL(blob);
  </script>
</div>

share/templates/html/beamerframe-embedded.html  view on Meta::CPAN

<section class="slide"
	 id="---SLIDEID---"
	 data-menu-title="---DATAMENUTITLE---"
	 data-transition="---TRANSITION---"
	 data-background-transition="---TRANSITION---"
	 ---AUTOSLIDE---
	 >
  <script type="module">
    const encoded = `
---SLIDEEMBEDDEDB64---`;
    const bytes = Uint8Array.from(atob(encoded), c =>c.charCodeAt(0));
    const blob = new Blob([bytes], { type: "---MIMETYPE---" });
    
    const slide = document.getElementById("---SLIDEID---");
    slide.setAttribute( "data-background-image", URL.createObjectURL(blob) );
    if (window.Reveal) Reveal.sync();
  </script>
---SLIDECONTENT---
<aside class="notes">---NOTESIMAGE---</aside>
</section>

share/templates/html/iframe-embedded.html  view on Meta::CPAN

			     height: 100%;
			     ">
  <iframe id="---IFRAMEID---" 
	  style="margin: 4pt;
		 display: block;
		 width: ---W---;
		 height: ---H---;
 		 object-fit: ---FIT---;"></iframe>
  <script type="module">
    const encoded = `
---IFRAMEEMBEDDEDB64---`;
    const iframe = document.getElementById("---IFRAMEID---");
    iframe.srcdoc = atob(encoded);
  </script>
</div>

share/templates/html/image-embedded.html  view on Meta::CPAN

			     height: 100%;
			     ">
  <img id="---IMAGEID---"
       style="margin: 0;
	      display: block;
	      width: ---W---;
	      height: ---H---;
	      object-fit: ---FIT---;">
  <script type="module">
    const encoded = `
---IMAGEEMBEDDEDB64---`;
    const bytes = Uint8Array.from(atob(encoded), c =>c.charCodeAt(0));
    const blob = new Blob([bytes], { type: "---MIMETYPE---" });
    
    const image = document.getElementById("---IMAGEID---");
    image.src = URL.createObjectURL(blob);
  </script>
</div>

share/templates/html/note-embedded.html  view on Meta::CPAN

<img id="---NOTEID---"
     width="100%" height="100%">
<script type="module">
  const encoded = `
---NOTEEMBEDDEDB64---`;
  const bytes = Uint8Array.from(atob(encoded), c =>c.charCodeAt(0));
  const blob = new Blob([bytes], { type: "---MIMETYPE---" });
  const note = document.getElementById("---NOTEID---");
  note.src = URL.createObjectURL(blob);
</script>

share/templates/html/still-embedded.html  view on Meta::CPAN

			     width: 100%;
			     height: 100%;
			     ">
  <video id="---STILLID---"
	 style="width: ---W---;
		height: ---H---;
 		object-fit: ---FIT---;
		"></video>
  <script type="module">
    const encoded = `
---STILLEMBEDDEDB64---`;
    const bytes = Uint8Array.from(atob(encoded), c =>c.charCodeAt(0));
    const blob = new Blob([bytes], { type: "---MIMETYPE---" });
    const still = document.getElementById("---STILLID---");
    still.src = URL.createObjectURL(blob);
  </script>

</div>

share/templates/html/video-embedded.html  view on Meta::CPAN

			     height: 100%;
			     ">
  <video id="---VIDEOID---"
	 ---AUTOPLAY--- ---CONTROLS--- ---LOOP---
	 style="width: ---W---;
		height: ---H---;
 		object-fit: ---FIT---;
		"></video>
  <script type="module">
    const encoded = `
---VIDEOEMBEDDEDB64---`;
    const bytes = Uint8Array.from(atob(encoded), c =>c.charCodeAt(0));
    const blob = new Blob([bytes], { type: "---MIMETYPE---" });    
    const video = document.getElementById("---VIDEOID---");
    video.src = URL.createObjectURL(blob);
  </script>
</div>



( run in 0.839 second using v1.01-cache-2.11-cpan-71847e10f99 )