Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-04-03 12:39:49

Gallex
Member
Registered: 2006-10-08
Posts: 1,292

scripts inside an article

could anybody tell, why this code works (player starts to stream) in page template, but don’t work in article?
if i insert it into an article, browser code inspector says: Uncaught SyntaxError: Invalid or unexpected token

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video" width="100%" height="260" controls autoplay class="videoCentered"></video>
<script>
  if(Hls.isSupported()) {
    var video = document.getElementById('video');
    var hls = new Hls();
    hls.loadSource('http://tv.eenet.ee/hls/metsis.m3u8');
    hls.attachMedia(video);
    hls.on(Hls.Events.MANIFEST_PARSED,function() {
      video.play();
  });
 }
</script>

Offline

#2 2018-04-03 12:51:22

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,305

Re: scripts inside an article

You can use notextile.. before that code, on the same line, as usual in Textile (note the space at the end) or place the code inside Textile barriers ==, immediately before and after that code, i.e. no spaces.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2018-04-03 13:23:35

Gallex
Member
Registered: 2006-10-08
Posts: 1,292

Re: scripts inside an article

uli wrote #310585:

You can use notextile.. before that code, on the same line, as usual in Textile (note the space at the end) or place the code inside Textile barriers ==, immediately before and after that code, i.e. no spaces.

thank you, uli!

Offline

Board footer

Powered by FluxBB