Wowza Community

Simple Wowza RTC playback into an HTML5 video element

So I have scoured the forums and Wowza documentation and cannot find a simple solution that allows the HTML5 video element to playback a Wowza stream from the Wowza Servers. I can get the playback through Wowza’s example Javascript injection, but cannot get that done with just the HTML5 video tags, which complain about the source being unplayable.

The settings in Wowza were setup to allow RTP instead of MPG4 or other such formats.

Sample Twig rendered HTML file to inject the variables needed:

The error basically rejects the Wowza stream saying it cannot be played on Firefox v79.

Can you clarify your workflow please? You have posted in ClearCaster bur are you asking about WebRTC in Engine and running an HTML5 player for the playback on Firefox 79- is that correct? If so have you tested this on a browser other than Firefox to see if it’s Firefox that’s the issue and not your configuration? That would be the first thing we’d recommend is to try in Chrome (for example) and to also make sure you are using the correct video and audio codecs for webrtc with Firefox.

Two things to check right away:

  • For Mozilla Firefox, Wowza Streaming Engine only supports WebRTC over UDP. WebRTC sessions over TCP aren’t supported.
  • If your WebRTC stream uses H.264 video, only the audio needs to be transcoded so that your content can be delivered over the standard formats.

Also:

1. add the video element to the page
2. use document.getElementById (jquery doesn't seem to work) and assign to variable
3. assign the stream to the videoElement.srcObject

The code for this is in our GitHub example dev/shared/lib/WowzaPeerConnectionPlay.js file. Look around line 96.

https://github.com/WowzaMediaSystems/webrtc-examples/blob/master/src/lib/WowzaPeerConnectionPlay.js

Thank you for the quick response. I suspected, I would need to assign the strream to the HTML element via Javascript injection, just thought to get confirmation, since other video formats like MP4 play directly with HTML5 just by assigning the source attribute n the video tag.

What I noticed with the Wowza Streams is that sometimes the playback does not kick in even though the console logs show a positive status 200.

Anyway to fix this recurrent problem?

Refreshing the Wowza Stream does not, though restarting the Wowza Application does.

Thanks for the additional info @Remi Fayomi. Based on your screenshots, are you running the sample code from the latest GitHub examples as well as the latest version of Streaming Engine? The examples in Engine installers can become outdated rapidly, so we make the examples available on GitHub for continued access to the latest fixes, improvements, and new example functionality

https://github.com/WowzaMediaSystems/webrtc-examples/blob/master/src/lib/WowzaWebRTCPlay.js


We did check though for you and we’re not seeing this problem on our end or in any tickets from customers, so this is most likely an issue in your config. You can submit a support ticket if you’d like us to look at why this is happening on our sample page for you though.

Also, please note that the WebRTC HTML 5 player requires the appropriate javascript skills necessary to translate the code for your own webrtc application. If you’re in need of some assistance, our Professional Services team can help and you can also post in the Hire A Consultant forum.

The Wowza publishing JS has the snippet below:

/*

  • This code and all components © Copyright 2019-2020, Wowza Media Systems, LLC. All rights reserved.

  • This code is licensed pursuant to the BSD 3-Clause License.

*/

import { mungeSDPPublish } from ‘./WowzaMungeSDP.js’;

import WowzaPeerConnectionPublish from ‘./WowzaPeerConnectionPublish.js’;

import SoundMeter from ‘./SoundMeter.js’;

window.AudioContext = window.AudioContext || window.webkitAudioContext || false;

Thanks for the link. So I used the new sourcecode from GitHub and both Wowza Publisher and Player worked well yesterday until later that day. Then the Publisher failed and continues to fail this norming with the error “Publish failed. Unable to connect”.
See console logs below. Seems ICE is failing too, but nothing was changed in the code when it worked and now, sot his is confusing.

That is confusing, but we are always updating our GitHub samples, especially right now with the player component to make it easier to implement and maybe we were in the middle of an update. Let me know if it happens again. If you need some help with any of this as far as building the player, reach out to Pro Services here or even post in Hire A Consultant.