Solved

PHP code enhancement

Posted on 2012-03-15
4
334 Views
Last Modified: 2012-05-04
Good afternoon.

What I am trying to do on the playlist tab. Currently I have a PHP code that randomly generates a playlist each time the user clicks on the category. What I want to do is now have the ability to load 5 seconds (mp3) that will load every 5 songs. for example one of the add is a voice clips "You’re  listening to HIPHOP and R&B provided by theonlinebeatz.com I want that mp3 clip to load every 5 other mp3's.
 
 (I still want to keep the way that is being generated randomly)
autoplaylist.php
0
Comment
Question by:Zirwo02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 13

Expert Comment

by:joomla_php
ID: 37729394
What is the mechanism that plays the mp3 now? I think this would be an ffmpeg type of operation in which the full mp3 is edited on the fly to snip out the 5 second clip.
0
 
LVL 14

Expert Comment

by:Scott Madeira
ID: 37730752
Sounds like you have a list of songs in an array that is your playlist.  Or you are randomly getting songs and playing them in a loop.  Before playing a song you want to check to see if you played 5 songs.  If so, play an ad....  The logic would be something like this:

$counter = 0;

While ($play_songs == true){

    // play the song
 
    // use the modulus to track every multiple of 5 to play an ad
    if ( ! $counter % 5) {
          // play an ad
    }

    $counter++;
}

Sorry, can't be more specific without the code you are using...
0
 

Author Comment

by:Zirwo02
ID: 37731858
the php code is attahced and that's what I use to generate the playlist. Let me know what else you need.
0
 
LVL 34

Accepted Solution

by:
Slick812 earned 500 total points
ID: 37744060
greetings Zirwo02, , I looked at your code file of  autoplaylist.php  , there's too much code in it for me to spend time on trying to figure out how to help you, I can see that the method-function that makes the play-List is   makePlaylist(  )  , , however this is NOT a short function and does several many things to make a play list, to make it even more complex, it adds sub-items like artist, title and image.
I do not really know how the XML is suppose to read to be workable for this, and I do not have time to install and use the  autoplaylist.php  stuff and see what the XML will be, ? ?
I will guess that you want to insert a line in the XML for your ads that would be =
<item><filename>/home/domain/pickle/theonlinebeatz.mp3</filename></item>

you may could do this in the  makePlaylist(  )   method-function,   do you have code you can show where you altered the  makePlaylist(  )  function to try and get this?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress Pagination 1 44
Problem to Office 1 43
Wordpress and Wufoo 1 39
Problem to copy file 14 51
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question