3 de julio de 2008

Documentación Mp3Player - ActionScript 2.0

Hola !

Les traigo una api que hice hace un tiempo pero se me había pasado compartirlo, es para hacer reproductores mp3 en flash con actionscript 2.0, es muy sencillita de utilizar.

Documentación:

------------------------------------------------------------------------------------------------

Paquete: com.jahepi.mp3player
Clase: public class Track
Herencia: Object

Encapsula las propiedades básicas de una pista.

Propiedades Públicas


url:String
Dirección del mp3.

name:String
Nombre del mp3.

------------------------------------------------------------------------------------------------

Paquete: com.jahepi.mp3player
Clase: public class Player
Herencia: Object

La clase Player te permite crear reproductores flash de manera sencilla, el objetivo de esta clase era el no acoplar los elementos gráficos y así tener la libertad de realizar tus propios diseños de reproductores.

Se emplearon 3 patrones de diseño para la realización, uno de ellos el Singleton, esto quiere decir que solamente se puede obtener una instancia de la clase Player, esto lo hice porque en las aplicaciones se utiliza un solo reproductor por lo general.

Además con Singleton tenemos un acceso global a nuestra instancia.

El siguiente fue el Patrón de Estado, para manejar los diferentes estados en el que puede estar un reproductor como cuando esta en pausa, en reproducción, etc., y por último uno que va de la mano con el Patrón de Estado , una Fábrica-Peso Ligero para no estar creando instancias de nuestros estados cada ves que se requieran.

Propiedades Públicas

stream:Bolean
Valor booleano que indica si la carga del mp3 se hace en modo stream.

volume:Number
Número del 0 al 100 que indica el volumen del track en reproducción.

Métodos Públicos

[Static] getInstance:Player
Con este método estático obtenemos la instancia de nuestro Player.

addTrack(track:Track):Void
Añade un objeto track a la lista de reproducción.

removeTrackAt(index:Number):Track
Remueve un objeto track de la lista de reproducción.

getTrackAt(index:Number):Track
Obtenemos un objeto track de la lista de reproducción de acuerdo al índice pasado como parámetro.

tracksIterator():IIterator
Devuelve un objeto iterador para recorrer la lista de reproducción.

playTrackAt(index:Number):Void
Inicia la reproducción de un track de la lista de reproducción de acuerdo al índice pasado como parámetro.

playNextTrack():Void
Inicia la reproducción del siguiente track en la lista de reproducción.

playPrevTrack():Void
Inicia la reproducción del anterior track en la lista de reproducción.

getCurrentTrack():Track
Obtenemos el track actual de la lista de reproducción.

stop():Void
Cancela la reproducción del track actual en la lista.

play():Void
Inicia la reproducción del track actual de la lista.

pause():Void
Pausa la reproducción del track actual de la lista.

getSeconds():Number
Obtenemos el número de segundos de la reproducción del track actual de la lista.

getTrackLoadPercentage():Number
Obtenemos el porcentaje de carga del track actual de la lista.

getTrackPlayingPercentage():Number
Obtenemos el porcentaje de reproducción del track actual de la lista.

setTrackPosition(percentage:Number):Void
Cambiamos la posición de reproducción del track actual, el parámetro percentage debe se un número entre el 0 y 100, como 10.2, 99, 32.45, etc…, si el player esta en modo stream y se pone un porcentaje mayor al cargado, este se ajustará automáticamente.

Eventos

TRACKLOADINGPROGRESS
Evento que se dispara cada ½ segundo cuando empieza la carga del track hasta finalizar.

TRACKLOADINGSTART
Evento que se dispara cuando la carga del track inicia.

TRACKLOADINGCOMPLETE
Evento que se dispara cuando la carga del track finaliza.

TRACKCOMPLETE
Evento que se dispara cuando finaliza la reproducción total del track.

TRACKPLAYING
Evento que se dispara cada ½ segundo cuando el track esta en reproducción hasta finalizar.

ERROR
Evento que se dispara al ocurrir un error inesperado.

------------------------------------------------------------------------------------------------

Les dejo el archivo junto a un ejemplo para que vean cómo se utiliza, cualquier pregunta no duden en contactarme.

ARCHIVO

Ojalá les sea útil.

Un saludote !

29 comentarios:

Isaac dijo...

cómo podriamos hacer para que se repita la misma rola q esta tocandose? alguna idea?

probe con ponerle:

player.play();

pero lo que hace de esta forma es volver a cargarla, e teoria ya la tenemos cargada, solo seria repetirla, ojala se nos ocurra algo, saludos!

jahepi dijo...

Hola Isaac !

Perdón, es un poco tarde la respuesta.

Tienes que escuchar por el evento TRACKCOMPLETE, para saber cuando termine la canción y de esa manera volver a reproducirla:

var player:Player = Player.getInstance();
player.stream = true;
player.addEventListener(Player.TRACKCOMPLETE, onComplete);

funciton onComplete(evt:Object):void {
player.playTrackAt(0);
}

En el método playTrackAt, le pasamos como parámetro 0 (la cuenta empieza desde 0), para que reproduzca la primera canción de nuevo.

Un saludote !

Brandon dijo...

Hola bueno solo dejo este comentario porque me interesaria saber si puediera trbajar tu diseño de tu blog aqui te dejo mi email: peruxo_95@hotmail.com

Mork dijo...

Hola,
Ya se que ha pasado tiempo desde que utilizaste este API, pero tengo una pregunta que hacerte. Estoy utilizandolo, y me gustaria saber como poner en pausa/stop al cargar el audio, que no empieze a reproducir. Me echarias una mano?
Gracias

Anónimo dijo...

Solar eneragy is the future for the world.
[url=http://www.solarcourses.org/]solar courses[/url]

Anónimo dijo...

yohoo personals [url=http://loveepicentre.com/]overweight dating site[/url] pre teen dating sites http://loveepicentre.com/ agency black dating online

Anónimo dijo...

homeopathic eye infection cures [url=http://usadrugstoretoday.com/products/cialis.htm]cialis[/url] certification health education specialty http://usadrugstoretoday.com/products/capoten.htm effect of diabetes to respiration http://usadrugstoretoday.com/categories/ipnoterapia.htm
weight loss diet pill programs san antonio [url=http://usadrugstoretoday.com/products/zyban.htm]zyban[/url] medical examiner green bay wi [url=http://usadrugstoretoday.com/products/generic-imitrex.htm]diet pills new prescription[/url]

Anónimo dijo...

dictionary of health benefits of juicing [url=http://usadrugstoretoday.com/products/maxalt.htm]maxalt[/url] free medical dictionary software downloads http://usadrugstoretoday.com/products/alpha-lipoic-acid.htm greenwood village health and rehab http://usadrugstoretoday.com/products/sarafem.htm
catastriohic medical insurance plans [url=http://usadrugstoretoday.com/products/cefadroxil.htm]cefadroxil[/url] short summary of the tell tale heart [url=http://usadrugstoretoday.com/products/zovirax.htm]probation and parole drug testing[/url]

Anónimo dijo...

medical laboratory technology schools [url=http://usadrugstoretoday.com/products/prazosin.htm]prazosin[/url] diagnosed with inflammatory breast cancer http://usadrugstoretoday.com/products/herbolax.htm bc health care http://usadrugstoretoday.com/products/lotrisone.htm
college medical school [url=http://usadrugstoretoday.com/products/glyset.htm]glyset[/url] diet for strong fingernails [url=http://usadrugstoretoday.com/products/kamagra-oral-jelly.htm]bill bracciodieta health net[/url]

Anónimo dijo...

pawing at your heart [url=http://usadrugstoretoday.com/products/colchicine.htm]colchicine[/url] smoke as a symbol in art http://usadrugstoretoday.com/products/rave--energy-and-mind-stimulator-.htm diabetes exercise and sports association http://usadrugstoretoday.com/products/micardis.htm
evista igia [url=http://usadrugstoretoday.com/products/baclofen.htm]baclofen[/url] feline epilepsy anxiety treatment [url=http://usadrugstoretoday.com/categories/parte-pills.htm]dental clinics bangalore[/url]

Anónimo dijo...

http://online-health.in/ashwagandha/benefits-of-ashwagandha-root-and-usage
[url=http://online-health.in/antibiotic/antibiotic-common]pharmacy quick lab[/url] krogers pharmacy [url=http://online-health.in/asthma/environmental-factors-effecting-asthma]environmental factors effecting asthma[/url]
pharmacy for sale http://online-health.in/atrovent/two-inhalations-for-atrovent
[url=http://online-health.in/aspirin/aspirin-for-a-fever]anti free drug posters[/url] eckerd drug richardson texas [url=http://online-health.in/arimidex/stopping-arimidex]stopping arimidex[/url]
pharmacy technician test book http://online-health.in/benfotiamine/benfotiamine-dosage
[url=http://online-health.in/atrovent/allergies-to-atrovent]rx nutrition people who take statin drugs[/url] drug vesicant [url=http://online-health.in/aricept/aricept-namenda-actonel]aricept namenda actonel[/url] discount cialis generic [url=http://online-health.in/biaxin/is-biaxin-effective-against-strep]is biaxin effective against strep[/url]

Anónimo dijo...

citizens of mexico travel requirements http://greatadventures.in/tour/slice-of-brooklyn-pizza-tour budget travel deals vacations
[url=http://greatadventures.in/airlines/vergin-airlines]romainia travel guide[/url] train travel transmongolian [url=http://greatadventures.in/expedia/expedia-travel-coupon-codes]expedia travel coupon codes[/url]
bike pro travel case http://greatadventures.in/tour/tour-lockheed-martin
[url=http://greatadventures.in/airlines/frontier-airlines-information]concessions travel professionals los angeles[/url] list airlines that travel to indonesia [url=http://greatadventures.in/airline/delta-airline-vacation-package]delta airline vacation package[/url]
andante travel http://greatadventures.in/tourist/egypt-tourist-office-london san stefanos travel [url=http://greatadventures.in/tours/grise-fiord-tours]grise fiord tours[/url]

Anónimo dijo...

information on iversonsnowshoes http://topcitystyle.com/?action=products&save_s_prm=1&pr_sort_=id graphic designers [url=http://topcitystyle.com/-club-wear-men-category69.html]leopard ralph lauren[/url] laurence harbor twp
http://topcitystyle.com/khaki-accessories-color28.html gola shoes [url=http://topcitystyle.com/44-dolce-amp-gabbana-size26.html]spa style clothes hamper[/url]

Anónimo dijo...

fashion stylists located in chicago il http://topcitystyle.com/m-new-size5.html international fashion schools [url=http://topcitystyle.com/48-long-sleeve-tops-size1.html]aanstadt das riding clothes[/url] childrens designer clothing
http://topcitystyle.com/off-white-pullover-color3.html fashion fever [url=http://topcitystyle.com/black-brown-red-leather-shoes-color127.html]joan and david shoes[/url]

Anónimo dijo...

model jennifer lauren http://topcitystyle.com/44-women-size26.html fashion designers [url=http://topcitystyle.com/black-white-men-color117.html]recipe for old fashioned malt[/url] selby women shoes
http://topcitystyle.com/navy-blue-yellow-women-color210.html giada de laurentiis nude [url=http://topcitystyle.com/emilio-pucci-firenze-winter-jackets-brand121.html]carolyn bessette kennedy fashion[/url]

Anónimo dijo...

hentai 3 adult inractive ames free http://theporncollection.in/gay-movie/gay-chubby-sample
[url=http://theporncollection.in/free-hentai/gay-hentai-yaoi]adult foster family caregivers[/url] pokemon team sexy galactic [url=http://theporncollection.in/sex-mature/juggs-mature-naturals]juggs mature naturals[/url]
katara sexy http://theporncollection.in/gay-boy/is-she-gay
[url=http://theporncollection.in/mature-woman/anna-lisa-mature]drwaing hentai[/url] lesboan porn [url=http://theporncollection.in/lesbian-xxx/kat-young-lesbian-movies]kat young lesbian movies[/url]
two sided dildo http://theporncollection.in/gay-man/free-gay-male-lovers-passion-porn-photo-gallery
[url=http://theporncollection.in/gay-male/webcam-free-gay]adult victims of childhood sexual abuse[/url] sexy naked mothers [url=http://theporncollection.in/porn-girl/country-girl-porn-thumbnails]country girl porn thumbnails[/url]
sexy erotic naked ladies videos http://theporncollection.in/moms/stay-at-home-moms-keeping-house-clean-and-organized
[url=http://theporncollection.in/gay-xxx/gay-cruise-lines]hentai hot juicy teacher[/url] sperm shooting dildo [url=http://theporncollection.in/mature-woman/mature-grany-clips]mature grany clips[/url]

Anónimo dijo...

cosmopolitan south africa fashion pages http://www.thefashionhouse.us/27-shorts-size17.html running shoes online [url=http://www.thefashionhouse.us/gianfranco-ferre-shirts-brand23.html]aaa replica gucci twirl watch[/url] ladies sexy clothes
http://www.thefashionhouse.us/shoes-gucci-type4.html gothic cloing and shoes [url=http://www.thefashionhouse.us/red-underwear-color8.html]opinions for comfortable shoes[/url]

Anónimo dijo...

site work health and safety in ireland [url=http://usadrugstoretoday.com/products/ventolin.htm]ventolin[/url] massachusetts board of allied health professionals http://usadrugstoretoday.com/products/alavert.htm
how to shoot a turkey [url=http://usadrugstoretoday.com/products/mevacor.htm]mevacor[/url] boyle health unit [url=http://usadrugstoretoday.com/products/cordarone.htm ]coumadin diet low cholesterol low fat owsugar [/url] tea from england
non heart beating organ donor [url=http://usadrugstoretoday.com/products/provigrax.htm]provigrax[/url] alcoholism as cause of hypertension http://usadrugstoretoday.com/products/alavert.htm
dog urinary infection symptoms [url=http://usadrugstoretoday.com/products/kamasutra-dotted-condoms.htm]kamasutra dotted condoms[/url] cross your heart bras [url=http://usadrugstoretoday.com/index.php?lng=fr&cv=eu ]ace inhibitors kidney disease [/url] different types of breast tumours

Anónimo dijo...

miss sixty shoes http://www.thefashionhouse.us/de-puta-madre-69-hoodies-brand15.html kleine pimmel [url=http://www.thefashionhouse.us/roberto-cavalli-shoes-brand7.html]plus size clothes[/url] seventh avenue fashion
http://www.thefashionhouse.us/hoodies-page5.html chinese hand laundry nyc servics shoes [url=http://www.thefashionhouse.us/purple-brown-casual-color27.html]aravon comfort shoes[/url]

Anónimo dijo...

urinary system games [url=http://usadrugstoretoday.com/categories/generale-per-la-salute.htm]generale per la salute[/url] benigh lump on prostate http://usadrugstoretoday.com/#third
goverment health insurance low income michigan [url=http://usadrugstoretoday.com/products/claritin.htm]claritin[/url] prescription strength zantac [url=http://usadrugstoretoday.com/products/aleve.htm ]diet in nephrotic syndrome [/url] post anxiety stress disorder
affiliate marketing generic drugs [url=http://usadrugstoretoday.com/products/pro-erex.htm]pro erex[/url] purple heart wisconsin http://usadrugstoretoday.com/bestsellers.htm
rose street mental health wichita falls tx [url=http://usadrugstoretoday.com/terms.htm]drugstore terms[/url] muscle chemistry [url=http://usadrugstoretoday.com/products/revia.htm ]dental hygiene education ohio [/url] kidney and uti infections

Anónimo dijo...

horse shoes http://luxefashion.us/27-classic-denim-size17.html fashion museums in milan [url=http://luxefashion.us/34-dolce-amp-gabbana-size25.html]designer skin[/url] discount wide shoes
http://luxefashion.us/-club-wear-gucci-category32.html yahama brake shoes [url=http://luxefashion.us/s-casual-shirts-size10.html]pool shade clothes[/url]

Anónimo dijo...

diet for a diabetic [url=http://usadrugstoretoday.com/categories/erektile-dysfunktion.htm]erektile dysfunktion[/url] cpt medical coding http://usadrugstoretoday.com/products/lithium-carbonate.htm
health of homeless people in atlanta georgia [url=http://usadrugstoretoday.com/categories/de-la-salud-de-la-mujer.htm]de la salud de la mujer[/url] eastern medicine massachusetts [url=http://usadrugstoretoday.com/index.php?lng=de&cv=eu ]girl controls orgasm [/url] health research websites
seasonal affect disorder nutrition [url=http://usadrugstoretoday.com/products/indinavir.htm]indinavir[/url] vitamin d what it does http://usadrugstoretoday.com/categories/arreter-de-fumer.htm
medical judgements affecting the deaf and hard of hearing [url=http://usadrugstoretoday.com/products/levothroid.htm]levothroid[/url] goldman drug testing policy [url=http://usadrugstoretoday.com/products/brahmi.htm ]birth control drugs [/url] pictures of dental technology

Anónimo dijo...

travel info from raleigh durham airport to pinehurst http://xwl.in/airport/airport-homes-florida premier travel inns england
[url=http://xwl.in/lufthansa/untided-airways]different pioneers could travel west[/url] rapid city travel [url=http://xwl.in/hotel/hotel-holland-park-avenue]hotel holland park avenue[/url]
thailand travel books http://xwl.in/vacation-packages/find-cheap-vacation-packages-to-santa-fe-new-mexico
[url=http://xwl.in/plane-tickets/plane-tickets-from-budipest-to-keiv]health insurance travel companies illinois[/url] travel agent in santorini [url=http://xwl.in/cruise/st-lawrence-seaway-cruise-maritimes]st lawrence seaway cruise maritimes[/url]
us department of state condoleeza rice travel http://xwl.in/disneyland/disneyland-employee-death travel acxess voyages american express [url=http://xwl.in/travel/travel-from-meadowhall-to-chesterfield]travel from meadowhall to chesterfield[/url]

Anónimo dijo...

designer womens clothes http://luxefashion.us/paul-smith-men-brand96.html michael klein [url=http://luxefashion.us/m-women-apos-s-long-sleeve-tops-size5.html]chanel surfing[/url] kids old fashion tea parties
http://luxefashion.us/?action=products&product_id=2462 fashion games for teens [url=http://luxefashion.us/women-men-underwear-type3.html]snowboarding clothes[/url]

Anónimo dijo...

janine laurent http://www.thefashionhouse.us/grey-navy-blue-leather-shoes-color100.html hush puppies shoes [url=http://www.thefashionhouse.us/gucci-sandals-brand12.html]stonefly shoes[/url] clothes style
http://www.thefashionhouse.us/-casual-fall-spring-on-sale-category23.html fashions [url=http://www.thefashionhouse.us/41-gucci-size22.html]car designers[/url]

Anónimo dijo...

no deposit online casinos http://xwn.in/blackjack_blackjack-2-phone-cases arizion lottery power ball
[url=http://xwn.in/lottery_massachustts-lottery]gay bingo providence[/url] blackjack 55 styrafoam [url=http://xwn.in/online-casinos_scottsdale-casinos]scottsdale casinos[/url]
gambling interactive online uk http://xwn.in/jackpot_bartons-93-hotel-and-casino-jackpot-nevada
[url=http://xwn.in/jokers_jokers-tattoo-in-calgary]bingo toys[/url] casino video of crown princess tipping [url=http://xwn.in/slots_nickle-slots]nickle slots[/url]
hollywood casino tunica coupons http://xwn.in/joker_ho-joker mass state lottery results [url=http://xwn.in/betting_best-betting-advice]best betting advice[/url]

Anónimo dijo...

las vegas monte carlo casino http://wqm.in/gambling-online_gambling-bonus-poker-gambling california lottery home
[url=http://wqm.in/bingo_eagles-bingo-spokane]casinos st louis missouri[/url] gambling pittsburgh pa [url=http://wqm.in/keno_keno-internet-casino]keno internet casino[/url]
casino green acres game http://wqm.in/lottery_variety-childrens-charity-lottery
[url=http://wqm.in/betting_sports-and-betting-and-gambling]fiesta resort and casino costa rica[/url] the joker halloween costumes [url=http://wqm.in/betting_sports-betting-casino-online]sports betting casino online[/url]
online casino usa players no deposit required with sign up bonus http://wqm.in/joker_joker-design-tattoos what is financial spread betting [url=http://wqm.in/online-casinos_indian-casinos-california]indian casinos california[/url]

Anónimo dijo...

big lesbian movie [url=http://moviestrawberry.com/films/film_the_golden_boys/]the golden boys[/url] blood work the movie http://moviestrawberry.com/films/film_trail_of_the_pink_panther/ facts and fiction in the movie amadeus
ghostrider the movie [url=http://moviestrawberry.com/films/film_bonanno_a_godfathers_story/]bonanno a godfathers story[/url] gay fetish movie http://moviestrawberry.com/films/film_art_heist/ race movie
the movie hairspray 64129 [url=http://moviestrawberry.com/films/film_autumn_leaves/]autumn leaves[/url] gettysburg movie trilogy
movie size candy [url=http://moviestrawberry.com/films/film_phantasm/]phantasm[/url] ct movie theaters http://moviestrawberry.com/films/film_i_know_who_killed_me/ hot guy in the saint movie
the christmas carol movie british version [url=http://moviestrawberry.com/films/film_rome/]rome[/url] movie depicting social justice http://moviestrawberry.com/films/film_film_noir/ christian movie review rendition

Anónimo dijo...

free hentai dating simulation games http://loveepicentre.com/faq/ pots dating site
amy reimann dating dale jr [url=http://loveepicentre.com/testimonials/]dating doctors in denver[/url] online dating sources
internet dating class learning annex [url=http://loveepicentre.com/success_stories/]single dating[/url] dating usa indian marriages [url=http://loveepicentre.com/user/pete1210/]pete1210[/url] christian singles dating washington