Streaming audio in my Website - javascript

I am making a fan site for a music artist and I am having trouble with finding a reliable way to stream the music on the site. I have tried many different methods and none are giving me the results I am looking for.
I need the player to accept a direct URL as the source for the audio. As well as working on as many operating systems/browsers as possible. All of my audios are in mp3 format.
I currently have it working, but for some reason it seems like a hit or miss when the page loads some of the players work, some don't.
I have tried different hosting services and that didn't make a difference, so the issue is within the player itself.
I have modded this player to use in my site. This is the best of the many that I've tried, but if only it would load the songs more reliably I would be happy.
http://designmodo.com/audio-player/
And this is my audio tag in html.
<div class="audio-player">
<h1> Yea</h1> <h2> May 23, 2016</h2>
<h3> Lil Uzi Vert </h3>
<img class="cover" src="../playerimgs/cover.png">
<audio preload class="part14" src="http://dopefile.pk/mp3embed-df1s7uzu0d6b.mp3" type="audio/mp3" controls="controls"></audio>
</div>
I have many players on the same page. Some of them work on initial page load, and some of them require many refresh clicks to actually load. This is not practical.
So I am looking for one of two things,
1- How to fix my player so it is always working on initial load.
2- A different music player that is more reliable.
I know this idea is not impossible, but I am not having any luck finding the best way to do this. I've searched and used over a dozen different players and none work as much as this one. The only problem I am having with this setup is the music players not always working for some odd reason.
I can add the javascript if necessary, but I did not edit that at all.
Also, I do not plan on embedding other players in my site. I have tried this already and it is not efficient at all.
Thanks for any help or advise.
This website is a great example of what I would like my player to be like.
https://jams.to/
And this is my temporary page that I am working with my players on,
http://www.luvallday.com/Posts/Allsongs.aspx

I've done some work integrating audio into HTML5 games/interactive experiences, and the best library I've worked with so far is Howler. Very clean and easy to use API, and it performed very well cross-browser.

If you want your music to play automatically when page loads just add the "autoplay" attribute to the element tag...
Example :
<audio class="part14" src="http://dopefile.pk/mp3embed-df1s7uzu0d6b.mp3" type="audio/mp3" controls="controls" autoplay></audio>
Rare but if autoplay fails:
<script>
if(document.readyState == "complete"){
//grab the first player
var player = document.getElementsByTagName('audio')[0];
//play it
player.play();
}
</script>
Or
If you are more advanced I'd recommend wavesurfer.js , it gives a good music player for visuals ..
Here : http://wavesurfer-js.org/

So I found this player call Amazing Audio Player and it is pretty great. It worked well for what I wanted to do.

Related

Tried a way to make the webpage play the background music automatically but it doesn't seem to work?

Currently in the project, I hope to be able to play background music as soon as you enter the webpage, but chrome seems to have banned this!
Find a way to crack on the Internet, the reference website is as follows:
http://www.nooong.com/docs /chrome_video_autoplay.htm
But I tried to use the above method by myself, the effect is still useless.
I would like to ask you to help me to see if the spelling is wrong, or is it useless at all?
Maybe you have had similar needs, I hope you can share with me, I will be very grateful for your warm help, thank you again Everyone watch my question.
let trigger = document.querySelector('.trigger');
let autoplay = document.querySelector('.autoplay');
trigger.onload = function(){
autoplay.src = 'demo.mp3';
autoplay.oncanplay = function(){
autoplay.play();
};
};
<!-- background music to play -->
<audio autoplay="autoplay" controls="controls" loop ="loop" preload ="auto" class="autoplay">
<source src="demo.mp3" />
</audio>
<!-- First trigger the audio in the iframe, put an empty music file in it -->
<iframe allow="autoplay" style="display:none" class="trigger" src="demo.mp3"></iframe>
Currently in the project, I hope to be able to play background music as soon as you enter the webpage, but chrome seems to have banned this!
Chrome, and most other browsers.
Find a way to crack on the Internet, the reference website is as follows:
It isn't possible. The site you're looking at doesn't do it either. At best, you can play on some trusted user action, which is indeed the workaround proposed at the site you mention.
But I tried to use the above method by myself, the effect is still useless. I would like to ask you to help me to see if the spelling is wrong, or is it useless at all?
That's because there's nothing you can do about this problem. You can't play music as soon as a page is opened.

Displaying at least 100 videos on a single Web page

I would like to display a webpage with a wall of very short videos:
The videos are 1-2s long and all the same size (about 100px wide)
They are display in the form of a matrix (e.g. 10x10)
Playing the videos is triggered by user interaction (click or hover)
So far, I have tried inserting video tags using jQuery but when I reach about 60 videos, my browser (Chrome) hangs.
My question: is there a trick to display such a large quantity of videos on a single web page and what issue should I look out for to make sure the videos are ready to play before the user starts to interact.
EDIT: I understand this isn't common practice, but this project is an art installation and I need to be able to trigger all the videos (or moving images) on demand and without delay. On the other hand, the initial loading time doesn't matter so much, as the user will be made aware of the heavy load.
Thanks :)
IMO "videos are ready (...) before the user starts to interact" contradicts a leightweight DOM. You cannot have both. I'd try to show thumbnails and initialize the video with the interaction.
you could try to use the
use the
<video width="320" height="240" controls>
<source src="embed Link" type="video/mp4">
Your browser does not support the video tag.
</video>
tag inside of html. then you can acces every object by giving it a tag

How do I get an embedded youtube video to autoplay suggested videos?

The title pretty much sums my question up. I've given a cursory glance to https://developers.google.com/youtube/iframe_api_reference and have searched online but all I have found are explanations on how to get an embedded video to autoplay (the first video only) while preventing the suggested videos list at the end. I think that perhaps the logic for playing suggested videos is only supported on youtube.com itself, a conclusion that might be supported by the autoplay button being outside of the video element.
As a worst case solution, I thought maybe if I could save a youtube.com page to my desktop I could modify the styling to only show the video. But alas, the page breaks when I try to load it from my hard drive as opposed to the website.
Edit: Take note that I'm talking about two different types of autoplay here. One is the autoplaying of suggested videos as seen in the picture, and that is the type of autoplay I want to be able to use in an embedded player. The other type of autoplay that I don't need help with is getting the embedded player to automatically play the video that is contained in its iframe src, aka the first video.
Since you marked iframe under your tags and I can't comment, I will try to answer.
If you're using iframe then make sure
autoplay=1"
is on
<iframe id="ytplayer" type="text/html" width="720" height="405"src="https://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1"frameborder="0" allowfullscreen>
I found a link that will build it for you. It was a bit into the api link you gave.
https://developers.google.com/youtube/youtube_player_demo
You can give it the video and tell it what you want it to do.

Integrating .html extensions with VideoJS?

So i'm using the VideoJS HTML5 video player
on my in progress video streaming website.
The problem i've encountered is that the player has no problem playing links that end in the
(.MP4) extension. But the way my site functions is it acts as a video aggregator
by pulling links from various websites, the websites are similar to this one
taking that website link for example >
Notice how it ends with the .html extension and when you go to it, it has it's own unique video player, what I want to do is to be able to play that video in video js.
My aggregator saves links to the videos (.html , .php) and not the actual video file itself, is there a way of achieving this? or is it impossible? thanks!

playing links of music on my own video player

i have a problem, i have a player in my website and the music i want to play is just a link of music, and i want to play it in my own player. i need some idea about this...
thanks you!..
My favorite HTML5 solution for audio right now is this project: http://kolber.github.com/audiojs/
It "fixes" the users browser so the HTML5 <audio /> tag works no matter which browser they are using (IE, FF, Safari, etc). Then with just a sprinkling of JS you can just add something like this to your page:
<audio src="/mp3/juicy.mp3" preload="auto" />
Check out the project page, the setup shouldn't take more than 5-10 minutes.
Apparently there is also a videojs library to run HTML5 video. Its slightly more complicated but if you combine the two, it should give you all the power you need.
http://videojs.com/#getting-started

Categories

Resources