Getting started on displaying videos with the Brightcove iPhone SDK

There's a lot of good to be said about the Brightcove iPhone SDK, it's easy, it seems to work really well, but there's also a ton of gotchas and the docs are a little conflicting and/or out of date. The OnePlanet app is also out of date. This post is my attempt to rectify some of these things.

There are three things needed to get your app going:
You must be using your Read with URL Acccess token to fetch videos. Old accounts don't have this so you'll have to contact brightcove support to get them. Access this page from Home -> Account Settings -> API Management:

Read API tokens page

Next thing you need is to make sure that your UDS is enabled. You can find this page at Home -> Account Settings -> Publishing Settings:

Publish Settings page

Despite the documentation saying you need your videos to say Progressive Download it doesn't actually matter. All you need to do is adjust your call to be like this from this excellent doc:


bc = [[BCMediaAPI alloc] initWithReadToken:@"your read with URL Access api"];
// This makes UDS happen. Without it there is no happiness in the world.
[bc setUdsSupportOn:YES];

videoList = [ [ NSMutableArray alloc ] init ];

NSError *err;
BCPlaylist *bcp = [ bc findPlaylistById:1234512345L error:&err ];

if (bcp != nil) {
for (int i = 0; i [ videoList addObject: [ bcp.videos objectAtIndex: i ] ];
}
}

Other notes:

  • When using the OnePlanet app beware that the Headers/Libs have been set on the target as well as on the project so you need to amend their instructions to remove the Header Search Path and Library Search Path from the target.
  • Also with the OnePlanet app the BCMoviePlayer.bundle needs to be reimported from your SDK or it's not going to be happy.
  • The README states that you can call the BCMediaAPI calls without the additional frameworks MediaPlayer, OpenGLES, and QuartzCore but you actually need all three or no project you build is ever going to compile.
  • It's already been stated in the docs but Geo restricted videos just don't work yet. I'm not sure about the status of Localization yet.
  • Use the error catching logic from the best practices page, it helps a lot and it's actually pretty mandatory if you don't want blank players and app crashes.

Note: this article has been translated in to Belarusian by designcontest.com: link

I have been having major bugs with the one planet app in the search for the BCmediaAPI.h in particular, I had to add seperate search paths for every sub folder and the one error I still get is ld: library not found for -lBCiPhoneKit_iphonesimulator
can you help?

I am a video producer who needs to get content up on iPhone through my Brightcove account but am not getting far with getting this app to modify for my own simple video player app.

Thanks in advance.
Honcho

So there are two things that may help you, when you're doing the search paths make sure that you've set the search path on both the target and on the project. I believe that you can delete the search path on the target and let the project search paths take over but for some reason the OnePlanet app set the search paths on both places so even if you change one sometimes it doesn't work. This confused me for ages.

When you do set up the search paths there's a recursive button next to the path that should search through all the sub-directories. If that's not working for you then there's something bigger going on. Though I'd also check that you're running xcode 3.2 as I think that was a recent-ish addition (though I've been wrong before).

Lastly, the -lBCiPhoneKit thing, I've not seen this problem but it sounds a little like that line may be in the wrong place. Check the readme again to make sure but if it is in the right place make sure that you have a directory called BCiPhoneKit with the headers and libraries inside of it.

Let me know if that helps at all, I'm always happy to try to help.

I have successfully built the MyPlaylist demo and have added the code you posted above, I have the list and I can see my video listed but it still does not go to the next step which is "PLAY" And also how can I just iport the items I need into this model for a simple start page wit hthis list and a logo and then the ability to play the videos on cue. Once this is working we will then need to have the ability to set these clips as in app purchases, any feedback is greatky appreciated as I needed this app going like yesterday :-)!

I'm sorry, I don't know enough about your app to be able to answer your question. But I would definitely recommend posting this question on stackoverflow.com with your code so that more people can help out.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.

About the Author