Skip to content

Commit

Permalink
added wm ha lite version
Browse files Browse the repository at this point in the history
  • Loading branch information
maboa committed Sep 23, 2021
1 parent 286e69e commit a9c50e0
Show file tree
Hide file tree
Showing 3 changed files with 432 additions and 275 deletions.
18 changes: 18 additions & 0 deletions wp-hyperaudio/hyperaudio-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,26 @@ function hyperaudio_options_page()
<tr><td><code>media-height</code></td><td><code>640px</code></td><td>set the height of the audio or video</td></tr>
<tr><td><code>font-family</code></td><td><code>Arial, Helvetica, sans-serif;</code></td><td>set the font family of the transcript</td></tr>
<tr><td><code>id</code></td><td><code>mytranscript</code></td><td>sets the id of the trancript for sharing purposes</td></tr>
<tr><td><code>webmonetization</code></td><td><code>true</code></td><td>enables <a href="https://webmonetization.org/">Web Monetization</a> (<code>false</code> by default)</td></tr>
</table>
</p>
<p>For example:</p>
<p><code>[hyperaudio src="https://example.com/video/video.mp4" width="90%" transcript-height="600px" webmonetization=true]<br/>
&lt;article&gt;<br/>
&lt;section&gt;<br/>
&lt;p&gt;<br/>
&lt;span data-m="4470" data-d="0" class="speaker">Doc: &lt;/span&gt;<br/>
&lt;span data-m="4470" data-d="270">We &lt;/span&gt;<br/>
&lt;span data-m="4740" data-d="240">have &lt;/span&gt;<br/>
&lt;span data-m="5010" data-d="300">two &lt;/span&gt;<br/>
&lt;span data-m="5310" data-d="600">selves &lt;/span&gt;<br/>
...</br/>
&lt;/p&gt;<br/>
&lt;/section&gt;<br/>
&lt;/article&gt;<br/>
[/hyperaudio]
</code>
</p>
<p>And for those with the caption generating version ... </p>
<p>
<table>
Expand Down
10 changes: 8 additions & 2 deletions wp-hyperaudio/hyperaudio.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function hyperaudio_shortcode_handler($atts, $transcript, $tag)
$captionsOn = true;
$language = "en";
$trackLabel = "English";
$webmonetization = false;

if (isset($atts['src'])) $src = esc_html__($atts['src']);
if (isset($atts['width'])) $width = $atts['width'];
Expand All @@ -46,6 +47,8 @@ function hyperaudio_shortcode_handler($atts, $transcript, $tag)
if (isset($atts['language'])) $language = $atts['language'];
if (isset($atts['track-label'])) $trackLabel = $atts['track-label'];

if (isset($atts['webmonetization'])) $webmonetization = $atts['webmonetization'];


$transcript = preg_replace( "/\r|\n/", "", $transcript);

Expand Down Expand Up @@ -174,8 +177,11 @@ function hyperaudio_shortcode_handler($atts, $transcript, $tag)
selector: "article"
}).init();
var ht1 = hyperaudiolite();
ht1.init("'.$transcriptid.'", "hyperplayer'.$id.'", false);';
var minimizedMode = false;
var autoScroll = true;
var doubleClick = false;
new HyperaudioLite("'.$transcriptid.'", "hyperplayer'.$id.'", minimizedMode, autoScroll, doubleClick, '.$webmonetization.');';

if ($captionsOn == true) {
$o .= 'var cap1 = caption();
Expand Down
Loading

0 comments on commit a9c50e0

Please sign in to comment.