flash and jquery or html5 audio? - php

What is the best way to construct a audio player that can communicate with the jquery on my site?
Can I have flash send jquery commands when a song is finished playing?
Does html5 audio support a onSongEnd or similar function?
Songs on my site are a series of links that trigger jquery to reload a flash audio player with the appropriate song info. I would like to improve it so that I will automatically move on to the next song, or not depending on the users listening preferences. I would also like to be able to randomly play a promotional clip before playing the chosen song.
Do I need a custom flash player for this?
What is the best way to go about this?

Can I have flash send jquery commands when a song is finished playing?
Yes, you can; you can listen to the soundComplete event on the corresponding SoundChannel object and call the appropriate JavaScript (and hence jQuery) function from Flash using ExternalInterface.call().
You can find sample code for both classes in the examples section of their corresponding pages. The example for soundComplete demonstrates how to load and play the next song upon completing the currently played one - basically you load the next song from the soundComplete event handler of the current song.

I think Flash is still a safe bet. Take a look at jPlayer; it is a JQuery plugin for playing audio files. It has a beautiful with some useful items, user interface.

Related

HTML5 video playlist - filenames from MYSQL

I have a mysql table that has two fields - an identifier number, and text based url's stored in it of locations of some mp4 videos. I want to make a very simple html5 video player that when opened, looks at the database, loads the queue, and starts playing. when one song ends, it loads the next one in the list.
I'm pretty proficient with php and mysql, but what's stumping me is what code to alter on the html5 video player to get it to move to the next song in the database when the current song ends. basically in pseudo code :
(php/mysql) select idNum, URL from tracklist
HTML5 video source = first URL in the list
play the video
function (video's over)
get the next url
using ajax or something (???) swap out the player's source
keep playing with as little a gap as possible.
rinse and repeat :-)
simple really. just dont quite understand how to harness the html5 video and make it play nice with php. help!
If your playlist isn't likely to change very often, then I would generate some JavaScript containing an object for it when the page is called. You can load the HTML5 player with the source of the first video in the playlist and bind an event handler to the player such that when the video ends, it loads up the next one. See http://www.w3.org/2010/05/video/mediaevents.html for an example of a player and the events that are fired.
If the playlist is likely to change very often (i.e. after the page loads), you could make an Ajax call to update the playlist.

trigger audio .wav using php

Need advice, guidance on triggering a .wav file to play when a web page loads content and a specific keyword is within body of that content.
The content is being pulled from a Yammer network thru a custom app I created to look for certain hashtag messages using PHP. Now, I'd like to have a sound play (like a bell) when a specific hashtag has a new message. The bell would not ring a second time, just on the intial display.
Suggestions (using PHP)?
To play music in your site, place, <embed src="yourfile.wav"></embed> anywhere in page and checkout.
You can make it dynamic by using php in src.

Is any progress bar feature implemented with TCPDF API

From last 6 hours trying best to show progress bar wile pdf is generated in TCPDF but not successful.
I am using TCPDF API for HTML to PDF generation, But the problem is that while generating the PDF we can't use custom javascript, Can we show progress bar while PDF is generated?
Any idea please?
I am not sure why you say "can't use custom javascript". If you just want a "loading icon" yoy should do this
- show loading icon (from js)
- ajax request to php file that generates the pdf into a server file
- on success you get a link to a generated pdf.
(for this solution you might try some estimation based on how large would be the generated file)
If you want an accurate progressive, you should add some estimation on php file. Let's say when you generate the pdf you know how many pages you will generate and each "addPage" command you save the status of completeness in a file or a memcached key. On you JavaScript side you call a file each second that reads that status of completeness.
No.
Even if you were able to use custom javascript, it would not be possible to get an accurate prediction of the time it will take to generate the document and therefore diplay progress - but it would be possible to get an estimate (based on extensive benchmarking). But in order to display the progress bar you'd need custom javascript and to change the processing to decouple the threads on the browser and server. This is discussed more in this question (which IMHO is not a duplicate of the post referenced).

WordPress - How to have a static DIV that does not reload?

At the top of my new WordPress Theme for a radio website, I want to have a DIV at the very top of the page which contains a small flash player which will play the radio stream.
I would like this DIV to be static and NOT reload every time the user changes pages. What would be the best way to accomplish this?
Please provide a working demo on jsFiddle or something like that.
I think there are two ways to keep the music going
Either you use frames, so top frame(preferably 0px height) never
change and play the music
or you can build your whole site with ajax you only change what you need to change and don't touck the player.
you can try it with ajax that you just pull the content on page change request via ajax and fill you DOM(except music player part) as per your requirement and then you need not to reload your music player.
Other wise if your music player code is the part of you http request then not one can stop it's re-loading.

sending information from scripting side to flash video player

I don't know how to ask this, but the thing is that i was thinking that how does youtube or videofy.me like video blogs send the video path & all info to a flash video player i mean when e click on any video link how does it sets up everything and displays the chosen video, because actually i've created one but in that i had to set up the whole page via flash so that it can manipulate the information like path & name of the video, and cannot use html links, php and all.. so can u people tell me how do i start up & how this process is done & what i need to do & other important things on this.. i mean sending any info to a flash player via any scripting or server side language. Thank you..
There are several ways:
you can "hijack" clicks on links via JavaScript and JavaScript can communicate with flash (e.g. via ExternalInterface)
or you can change/add hash to the current page and Flash can be listening to such changes - this is how you could implement also flash deep linking for example
another option would be use javascript to remove the old video element from the page, and inject a new video (flash) element with the correct flashVars so the chosen video will play ...

Categories