2

I have a livestream, that I want to play on my HTA application.

I have tried using this answer.

<head>
     <title>Main</title>
     <meta http-equiv="x-ua-compatible" content="ie=edge" />
</head>

<body>
    <bgsound>
    <button onclick="playSound()">Play</button>

    <script language="javascript">
    function playSound() {
        document.getElementsByTagName("bgsound")[0].src = "https://www.url.org/stream";
    }
    </script>

</body>
</html>

(yes I'm missing a lot, but that shouldn't prevent it from running)

I press play, and nothing happens. How do I get it working?

Xantium
  • 11,201
  • 10
  • 62
  • 89
  • 1
    HTA... wow, it's been awhile! I'm surprised this still works. No errors in the debugging console you can see? – Brad Jun 14 '20 at 21:53
  • @Brad How do I get a debug console? I tried `mshta.exe test.hta` nothing happened. Yeah, as I'm already making a website I thought, may as well also go for a desktop edition too, this is the simplest, least effort solution. – Xantium Jun 14 '20 at 22:01
  • I don't remember, honestly, maybe there wasn't one? I haven't had to make an HTA in at least a decade. If you're building new, why not make a PWA? Same sort of thing, but you get to use modern features and it will work on other platforms. https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps – Brad Jun 14 '20 at 22:05
  • Will defenitly check it out thank you @Brad :) – Xantium Jun 14 '20 at 22:09
  • MSHTA uses the IE 9 engine and has not been updated since. – user692942 Jun 15 '20 at 09:10
  • 1
    See [JavaScript version in HTA](https://stackoverflow.com/a/19570684) – user692942 Jun 15 '20 at 09:27
  • @Lankymart I did actually read this, and did apply `` in my script. It didn't work unfortunatly – Xantium Jun 15 '20 at 15:58
  • 1
    @Simon The concepts you are trying to use are likely just not available to the rendering engine, remember that MSHTA is still the IE9 engine at heart, changing the doctype isn't going to magically give you the extra functionality. You might, however, be able to use a [polyfill](https://developer.mozilla.org/en-US/docs/Glossary/Polyfill#:~:text=A%20polyfill%20is%20a%20piece,do%20not%20natively%20support%20it.) that provides the extra functionality, the same way polyfills are used by websites to support older browsers. – user692942 Jun 15 '20 at 16:19
  • @Simon Right, so I should have looked at your code more carefully. You're using `` which is a deprecated tag in modern browsers so should work in an MSHTA. I think the reason it doesn't is that you are trying to give it a stream when [`` supports "the following types: .wav, .au, or .mid."](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bgsound) of which a live stream will not be one. – user692942 Jun 15 '20 at 16:39
  • Would look at [Play streaming audio in JavaScript](https://stackoverflow.com/q/46780836/692942) then look into what [polyfills you can use](https://html5please.com/#audio) to provide the functionality using that method. – user692942 Jun 15 '20 at 18:02

1 Answers1

0

You can give a try with the embed tag :

<embed src="url.to/stream" type="video/mp4" autoplay="1"/>

I just tested this on my windows 10 and it works like this example :

<html>
<head>
<title>Embedded video into HTA</title>
<HTA:APPLICATION
  APPLICATIONNAME="Embedded video"
  ID="Embedded video"
  ICON="nslookup.exe"
  WINDOWSTATE="maximize"
  VERSION="1.0"/>
<style>
body {
color:white;
background-color:lightblue;
background-image:url('https://apod.nasa.gov/apod/image/2001/DesertEclipse_Daviron_2000.jpg');
background-repeat:repeat;
background-size: 100%;
}
</style>
<script type="text/vbscript">
Sub Reload()
    window.location.reload(True)
End Sub
</script>
</head>
<body>
<center>
<br><hr>
<embed src="http://94.23.221.158:9197/stream" width=50% height=45% type="video/mp4" autoplay="1"/>
<br><hr>
<img src="http://www.icone-png.com/png/23/22961.png" Title="Reload Application video" alt="Reload Application video" onclick="Reload()" style="cursor:hand">
</center>
</body>
</html>
Hackoo
  • 18,337
  • 3
  • 40
  • 70