I use the following code to play an audio stream on my site and was wondering if how I could change the user-agent so that it appears in the streaming server logs as something other than 'Mozilla 5' for example. Ideally I want to set it to a custom value so that I can identify it in the logs.
I'm assuming that I may need something more custom (a custom developed player) to do this, or would it always display this as ultimately the request is coming from a browser?
<script>
var audio = new Audio("<?php echo $player_stream; ?>");
$('#play-pause-button, #play-pause-button-small').on("click", function() {
if ($(this).hasClass('fa-play')) {
$(this).removeClass('fa-play');
$(this).addClass('fa-pause');
audio.play();
} else {
$(this).removeClass('fa-pause');
$(this).addClass('fa-play');
audio.pause();
}
});
audio.onended = function() {
$("#play-pause-button, #play-pause-button-small").removeClass('fa-pause');
$("#play-pause-button, #play-pause-button-small").addClass('fa-play');
};
$(".btn-effect").click(function() {
$("." + $(this).attr('id')).css("display", "block")
});
</script>
You could try navigator.userAgent .
EXAMPLE:
var usr = navigator.userAgent;
and send usr
to the server.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.