Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Foreign Languages > Italian Forum
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

fa suonare un mp3 dal web

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-28-2012, 08:10 PM
fifiddu70's Avatar
Senior Member
 
Join Date: Jan 2012
Location: Partanna ( TP ) Italy
Posts: 194
Send a message via Skype™ to fifiddu70
Default fa suonare un mp3 dal web

Ciao a tutti, sto cercando di capire come far suonare un file mp3 che si trova nel mio sito web ho usato il seguente codice
Code:

Sub Globals
    
'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    
    
Dim btnSuona As Button
    
Dim mp3 As MediaPlayerStream
End Sub
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout(
"web")
    
End Sub

Sub Activity_Resume
    
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub btnSuona_Click
    mp3.Load(
"http://www.siciliabit.com/download/vienidame.mp3")
    mp3.Play
End Sub

non mi funziona mi da un errore su mp3.load, come mai?
Reply With Quote
  #2 (permalink)  
Old 01-28-2012, 08:28 PM
fifiddu70's Avatar
Senior Member
 
Join Date: Jan 2012
Location: Partanna ( TP ) Italy
Posts: 194
Send a message via Skype™ to fifiddu70
Default

allora, ho aggiunto initialize sul btnSuona e adesso l'errore non me lo da, ma non sento nulla, vedo che i monitor di download ed upload della connessione lavorano e appena finiscono non suona nulla.
come faccio a far suonare un file mp3 da internet?

Code:
Sub Globals
    
'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    
    
Dim btnSuona As Button
    
Dim mp3 As MediaPlayerStream
End Sub
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout(
"web")
    
End Sub

Sub Activity_Resume
    
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub btnSuona_Click
mp3.Initialize(mp3)
    mp3.Load(
"http://www.siciliabit.com/download/vienidame.mp3")
    mp3.Play
End Sub
Reply With Quote
  #3 (permalink)  
Old 02-01-2012, 07:05 PM
Junior Member
 
Join Date: May 2011
Posts: 27
Smile

Ciao fifiddu70

Prova a dare un'occhiata al codice di esempio su
Basic4android - Audio

In pratica, il Play deve essere eseguito quando il flusso è pronto. In tal caso viene scatenato l'evento "StreamReady".
Inoltre, nell'istruzione di inizializzazione devi indicare il nome della routine che gestisce l'evento (nell'esempio "mp") mentre nel tuo codice viene riportato il nome dell'oggetto mp3.

Ciao
Marco
Reply With Quote
  #4 (permalink)  
Old 02-03-2012, 02:46 PM
fifiddu70's Avatar
Senior Member
 
Join Date: Jan 2012
Location: Partanna ( TP ) Italy
Posts: 194
Send a message via Skype™ to fifiddu70
Default

magalt ho fatto come mi hai detto, funziona, solo che deve caricare il flusso prima di andare in play, pensavo che andasse in play da subito, invece credo che prima deve caricare tutto l'mp3 e poi te lo fa ascoltare.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On


All times are GMT. The time now is 11:40 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0