Streaming Video

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Streaming Video

Post by maxs » Sun May 15, 2011 12:13 am

Has anyone had any success streaming video from Youtube or a streaming server to an Iphone app? Is it a difficult task?

The Release notes for IOS have me totally confused. Do I use a rev player to steam a movie or do I uses iphoneControlCreate ? I get an error message that tells me it cannot find the handler.
How do I use these controls? Max


iphoneControlCreate "player", "ioscontrol"
iphoneControlSet "ioscontrol", "fullscreen", true
iphoneControlSet "ioscontrol", "preserveAspect", true
iphoneControlSet "ioscontrol", "showController", true
iphoneControlSet "ioscontrol", "a2"
--iphoneControlSet "ioscontrol", "filename", pathToYourMovieFile
iphoneControlDo "ioscontrol", "play"

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Streaming Video

Post by maxs » Tue May 17, 2011 8:25 pm

Do I use iphoneControlCreate "player", "ioscontrol" to create a player, or LiveCode's player tool?

Isn't there anyone who has used steaming video to an iphone app?

Max

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Streaming Video

Post by Klaus » Thu May 19, 2011 12:35 pm

Hi Max,

sorry for chiming in a bit late...

## I get an error message that tells me it cannot find the handler.
This is in the IDE, right?

Unfortuntaley the IDE does not recognize mobile specific handler/functions,
so you need to use an "if... then ..." structure:

Code: Select all

...
if the environment = "mobile" then
  iphoneControlCreate "player", "ioscontrol"
  iphoneControlSet "ioscontrol", "fullscreen", true
  ...
...
And yes, you need to use iphoneControlCreate "player", "ioscontrol" to create a player on iOS.
The "player" object in LiveCode IDE only works for desktop apps.


Best

Klaus

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Streaming Video

Post by maxs » Sat May 21, 2011 6:31 am

Frustrated out of my mind with the limited documentation on how to play a video.
Thank you Claus for trying.

OK iphoneControlDo sets up a player, but does not plat the video.
THe play command plays the audio of the video, but displays nothing.

on mouseup
if the environment = "mobile"
then
iphoneControlCreate "player", "ioscontrol"
iphoneControlSet "ioscontrol", "fullscreen", true
iphoneControlDo "/Users/macbookpro/Desktop/Letters/The Letter A.mp4", "play"
end if
play "/Users/macbookpro/Desktop/Letters/The Letter A.mp4", "play"
end mouseup

hliljegren
Posts: 108
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: Streaming Video

Post by hliljegren » Sat May 21, 2011 10:38 am

When using a player you need to test within the simulator or on a real device. If you try to use the play command on the desktop it will not play the video as it hasn't created any video player, and if you test in the simulator you can't reference files on you hard drive (/Users/Macbookpro...) due to the sandboxing model. To get the video's playing in the simulator you need to put it in the same folder as your app or a subfolder AND you also need to include that folder/file in the standalone.

If you wan't to build an app that works both on the desktop and on the iOS devices you can wrap your code in a command and then call that function to set up your player. On the desktop you can create a QuickTime player and on the iOS you create a "player" control.

Have you seen that there is a lesson about the subject? ( http://lessons.runrev.com/spaces/lesson ... een-in-iOS )
maxs wrote:Frustrated out of my mind with the limited documentation on how to play a video.
Thank you Claus for trying.

OK iphoneControlDo sets up a player, but does not plat the video.
THe play command plays the audio of the video, but displays nothing.

on mouseup
if the environment = "mobile"
then
iphoneControlCreate "player", "ioscontrol"
iphoneControlSet "ioscontrol", "fullscreen", true
iphoneControlDo "/Users/macbookpro/Desktop/Letters/The Letter A.mp4", "play"
end if
play "/Users/macbookpro/Desktop/Letters/The Letter A.mp4", "play"
end mouseup
___________________________________
MacBook Pro, 15" 2.6GHz i7 Mac OS X 10.10.4
iMac 27", 3.2 GHz Quad i7, Mac OS 10.10.4
LiveCode 7.0.6 or 8.0dp4

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Streaming Video

Post by Klaus » Sat May 21, 2011 11:48 am

Hi max,

the docs are sparse, but correct nevertheless!
So taking a look there will not hurt!

You are mixing two syntaxes:
-> play "/Users/macbookpro/Desktop/Letters/The Letter A.mp4", "play" ???
(Check "play" in the dictionary!)
and missed the most important part:
...
iphoneControlSet "ioscontrol", "filename", "YOUR_LOCAL_OR_INTERNET_URL_HERE"
...
## And then finally:
iphoneControlDo "ioscontrol", "play"
...

You need to include the commands for the desktop version in the ELSE case!

Code: Select all

on mouseup
   if the environment = "mobile" then
          iphoneControlCreate "player", "ioscontrol"
          iphoneControlSet "ioscontrol", "filename", "/Users/macbookpro/Desktop/Letters/The Letter A.mp4"
          iphoneControlSet "ioscontrol", "fullscreen", true
          iphoneControlDo "ioscontrol","play"

   ## We are on the desktop:
   ELSE
          ## play VIDEOCLIP "/Users/macbookpro/Desktop/Letters/The Letter A.mp4"
          ## This will NOT work on the desktop! 
          ## "PLAY" is extrememyl picky with fileformats!

          ## You need to create a player object and set its filename accordingly like this:
          set the filename of player "Your player here" to "/Users/macbookpro/Desktop/Letters/The Letter A.mp4"
          ## some more preparations for the movie display...
          start player "Your player here"
    end if
end mouseup
Best

Klaus

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Streaming Video

Post by maxs » Sat May 21, 2011 10:48 pm

Klaus and hliljegren ,

This is exactly what I needed. The lesson exmple really clarified it for me.

Also I see now where to put the file name.

Thank you, Max

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Still can't play video in ios

Post by maxs » Sat May 21, 2011 11:36 pm

OK "I'm trying to stream this video: http://www.youtube.com/watch?v=FEzxchU4RUY
first I tried
iphoneControlSet "ioscontrol", "filename", "http://www.youtube.com/watch?v=FEzxchU4RUY"

then I tried
play "http://www.youtube.com/watch?v=FEzxchU4RUY"

Nothing worked: Looking at the release notes, it appears that this should work.

Video playback support
Basic support for playing videos has been added using a variant of the play command. A video file can be played by using:
play ( video-file | video-url ) The video will be played fullscreen, and the command will not return until it is complete, or the
user dismisses it.
If a path is specified it will be interpreted as a local file. If a url is specified, then it must be either an 'http', or 'https' url. In this case, the content will be streamed.

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Streaming Video

Post by Klaus » Sun May 22, 2011 12:30 am

Hi Max,

1. this: "http://www.youtube.com/watch?v=FEzxchU4RUY" is just a HTML page
with the video embedded and not the URL of a video file that you could stream!

You need to supply the URL of the video file directly like:
"http://www.videoserver.com/videos/nice_one666.mp4"

2. The video on that page is in FLASH format and you know how Steve Jobs loves FLASH! 8)

Maybe this video is also avaialble in MP4 format (playable on iOS) somewhere on the YouTube
server but I have no idea how you could find this out.


Best

Klaus

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Streaming Video

Post by maxs » Sun May 22, 2011 3:15 am

I can't figure out how to get the url of a video. When I right click on it, it offers to copy the URL, but seems to return the HTML page. Anyways I just can't seem to load in any video, even from my onrev server, because I can't get the right address.

I was told I mistakenly put
just a HTML page with the video embedded and not the URL of a video file that you could stream!

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Streaming Video

Post by Klaus » Sun May 22, 2011 12:10 pm

Hi Max,

well, YouTube also "camouflages" the video url, means the FLASH videoplayer may be loading some XML file which leads to the correct url.

What do you mean with you cannot load a video from your own server?

You know that iOS does not play FLASH content?
You will need a MP4 or another iOS compatible video format for streaming.


Best

Klaus

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Streaming Video

Post by maxs » Sun May 22, 2011 9:07 pm

I finally got the video from the server. It was tricky trying to find the correct address.

Thanks for the heads up about YouTube. I use it for Facebook videos, so I thought it would work. I'll just have to look for another non-flash streaming server.

Thanks, Max
Max

gweinfurther
Posts: 1
Joined: Wed Jun 01, 2011 9:22 pm

Re: Streaming Video

Post by gweinfurther » Wed Jun 01, 2011 9:23 pm

Is there a way to detect when the video has finished playing?

Where can I find documentation for the properties of ioscontrol?

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Streaming Video

Post by Klaus » Wed Jun 01, 2011 11:55 pm

Hi gweinfurther,

in LiveCode:
menu: "Help -> "iOS Release Notes"

Best

Klaus

sx-72
Posts: 2
Joined: Wed Oct 12, 2011 12:01 am

Re: Streaming Video

Post by sx-72 » Wed Oct 12, 2011 6:55 pm

hliljegren wrote:
If you wan't to build an app that works both on the desktop and on the iOS devices you can wrap your code in a command and then call that function to set up your player. On the desktop you can create a QuickTime player and on the iOS you create a "player" control.

Have you seen that there is a lesson about the subject?
maxs wrote:Frustrated out of my mind with the limited documentation on how to play a video.
Thank you Claus for trying.

OK iphoneControlDo sets up a player, but does not plat the video.
THe play command plays the audio of the video, but displays nothing.

on mouseup
if the environment = "mobile"
then
iphoneControlCreate "player", "ioscontrol"
iphoneControlSet "ioscontrol", "fullscreen", true
iphoneControlDo "/Users/macbookpro/Desktop/Letters/The Letter A.mp4", "play"
end if
play "/Users/macbookpro/Desktop/Letters/The Letter A.mp4", "play"
end mouseup

Thanks for the link to the tutorial.. now that I have the video playing (sweet), how can I move the player window up higher on the screen?
I have been adjusting the:

Code: Select all

iphoneControlSet "ioscontrol", "rect", "0,200,320,500"
settings, but that only seems to control left and right not up and down on the screen.

Thanks

- Jay

Post Reply

Return to “iOS Deployment”