QuickTime Audio From a Server

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Pebah
Posts: 23
Joined: Mon Aug 01, 2011 9:35 pm

QuickTime Audio From a Server

Post by Pebah » Sat Sep 03, 2011 12:48 am

I'm wanting to play QT audio (music) from a server in my desktop app for Mac and PC. I'm playing the audio and doing something similar to the talking storybook in the LiveCode resources where I'm using callbacks from the player to trigger events. In my case I'm turning the border on and off around buttons in sync with timings in the music. This app will generally be used in a university with with a high-speed network, so I believe the music should play pretty well from the server. There might be 5-10 users simultaneously using the program from wherever they might be (it's a music "textbook").

1. Is a run-of-the-mill server operated by the Music Library going to have any difficulty with this?
2. Is there any server software required to do this better?
3. Should there be any issues with player playing audio from a server and still dishing out callbacks?
4. The audio format should probably be AAC (192 kbs) with with "Prepare for Internet Streaming" checked? Any other settings?

I would appreciate any expertise/experience with this. I have a couple of weeks to finish and get this all going!

mendocinotim
Posts: 14
Joined: Mon Sep 19, 2011 10:26 pm

Re: QuickTime Audio From a Server

Post by mendocinotim » Mon Sep 19, 2011 11:22 pm

I second this request..

In my case I send out a Nicecast stream - the file extension is .m3u (which is compatible with the QT player on my Mac).
I too would like to know about compatibility issues in an iOS device - since I plan to write an App that will play this stream.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: QuickTime Audio From a Server

Post by FourthWorld » Tue Sep 20, 2011 1:54 am

I've had generally good experiences setting the filename property of a player object to the URL to the stream.

Is that not working for you?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mendocinotim
Posts: 14
Joined: Mon Sep 19, 2011 10:26 pm

Re: QuickTime Audio From a Server

Post by mendocinotim » Tue Sep 20, 2011 2:47 am

FourthWorld wrote:I've had generally good experiences setting the filename property of a player object to the URL to the stream.

Is that not working for you?
I dragged a player object onto the card, and scripted the player with the following line of code..

Code: Select all

set filename of me to "hteeteepee://173.164.157.129:8101/listen.m3u""
It didn't work.
I also tried it this way..
1. In QT Player Pro 7, I used Open URL with that address, then saved it as a reference file with a .mov file extension.
2. It plays fine in QT after saving.
3. I then added the file using "Import as Control->Audio File" - which put it the Application Browser (the file name is listen.mov).
4. And finally, I coded it in the player object to..

Code: Select all

set the filename of me to "listen.mov
With the same negative result.

Maybe my syntax is wrong?
I am just starting to learn this - beginning today.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: QuickTime Audio From a Server

Post by bn » Tue Sep 20, 2011 8:00 am

Hi Tim,

could you try to convert it in QuickTime Player Pro 7 to m4v?

If you load an audio file in the QT-Player and then do an export you have the option for iPhone or iPad. Both propose m4v as format. A quick google search suggests that only special players on the iPad support m3u.

You could try with a short file to see if it works. I did successfully play m4v in a player on the iPhone/iPad.

Kind regards

Bernd

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: QuickTime Audio From a Server

Post by Klaus » Tue Sep 20, 2011 1:05 pm

Hi mendocinotim,

you need to set the filename (as the name says :D ) to a FILE, that means an external movie file!
This is not possible with "imported" sounds!

Add the "mov" file to your stanalone in the "standalone builder settings" -> "Copy files"!


Best

Klaus

mendocinotim
Posts: 14
Joined: Mon Sep 19, 2011 10:26 pm

Re: QuickTime Audio From a Server

Post by mendocinotim » Tue Sep 20, 2011 3:50 pm

bn wrote:Hi Tim,

could you try to convert it in QuickTime Player Pro 7 to m4v?

If you load an audio file in the QT-Player and then do an export you have the option for iPhone or iPad. Both propose m4v as format. A quick google search suggests that only special players on the iPad support m3u.

You could try with a short file to see if it works. I did successfully play m4v in a player on the iPhone/iPad.

Kind regards

Bernd
This is a live audio stream, hence the m3u extension - converting to m4v will not work.
I wonder what the special players are that google suggests?

mendocinotim
Posts: 14
Joined: Mon Sep 19, 2011 10:26 pm

Re: QuickTime Audio From a Server

Post by mendocinotim » Tue Sep 20, 2011 3:57 pm

Klaus wrote:Hi mendocinotim,

you need to set the filename (as the name says :D ) to a FILE, that means an external movie file!
This is not possible with "imported" sounds!

Add the "mov" file to your stanalone in the "standalone builder settings" -> "Copy files"!


Best

Klaus
Sorry - I don't understand what you are suggesting.
What does "standalone" mean here - remember, this is for an iPad/iPhone App, and is receiving a streaming audio broadcast from an external server, using m3u protocol - which is quicktime compatible.

I know I can create a web page with a compatible player, and that safari on the iPad can receive that just fine; but I would prefer to use a native player, if possible.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: QuickTime Audio From a Server

Post by Mark » Tue Sep 20, 2011 11:28 pm

mendocinotim,

You posted in the wrong thread. The current subject is about desktop apps, not about mobile apps.

You need to use the MPMoviePlayerController object. Check the iOS release notes for more information. The MPMoviePlayerController object can play movies on a server.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: QuickTime Audio From a Server

Post by bn » Wed Sep 21, 2011 11:59 am

Hi Tim,

after a bit of trial and error I found a way to play your streaming m3u file.

Just a simple stack with one card. The card script consists of

Code: Select all

sPlayerID
on opencard
   if the environment is "mobile" then
      iphoneControlCreate "player" 
      put the result into sPlayerID
      iphoneControlSet sPlayerID, "fileName", "http://173.164.157.129:8101/listen.m3u"
      iPhoneControlSet sPlayerID, "shouldAutoplay", "true"
      --iPhoneControlSet sPlayerID, "showController", "true"
      --iphoneControlSet sPlayerID, fullscreen, "false"
      --iphoneControlSet sPlayerID, "rect", "72,200,248,332"
      --iphoneControlSet sPlayerID, useApplicationAudioSession, "true"
      iphoneControlDo sPlayerID, "prepareToPlay"
      iphoneControlDo sPlayerID, "play"
      --put sPlayerID into field "fErr"
   end if
end opencard

on closeCard
   if the environment is "mobile" then
      iphoneControlDelete sPlayerID
   end if
end closeCard
It uses the MPMoviePlayer object -> iOS Release Notes. I commented out some options. The way it is now it plays the stream after a short latency (2-3 seconds) in the simulator. And it plays on an iPhone (in my case a 3G)

If you use this script make shure to include the script local variable "sPlayerID" that is above the opencard handler. It stores the ID of the "player".

obviously you might want to adapt the script to your needs, this is just a proof of principle.

Kind regards

Bernd

mendocinotim
Posts: 14
Joined: Mon Sep 19, 2011 10:26 pm

Re: QuickTime Audio From a Server

Post by mendocinotim » Sat Oct 15, 2011 8:07 am

Bernd,

Sorry, but I just found your reply here -

I see you got back to me in September, but I was never notified by this forum, of course.
I apologize, and thank you very much for the thoughtful reply.

Wow!!
I can see I was WAY over simplifying 'the way to do this.
I'll give your code a try.

Post Reply