Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP code enhancement

Posted on 2012-03-15
4
Medium Priority
?
339 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 2000 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

722 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