Category Archives: iOS

Making iOS Preview Videos (landscaped)

I had a post on this earlier, and I thought I had it figured out.  However, my latest silly App is landscape, and the same tricks don’t seem to work to force a nice 1920×1080 video.

After a little google work, I found this handy answer on SO:

http://stackoverflow.com/questions/25797990/capture-ios-simulator-video-for-app-preview

Using FFPMEG, it’s possible to scale up the video.  It seems you need to oversize it and then crop it.  The following commands are from the SO answer:

ffmpeg -i video.mov -filter:v scale=1084:1924 -c:a copy video_1084.mov
ffmpeg -i video_1084.mov -filter:v "crop=1080:1920:0:0" -c:a copy video_1080.mov

I ended up using slightly different commands, I was coming from a iPhone 6 landscaped video, so I needed to scale my output to 1928×1084 and then crop it to 1920×1080.  I also used .mp4 as the extension, as this is what iMovie exported them as.

Just as a side note, I don’t like making a fake iPad video, so I just record the gameplay with Quicktime and knock out a specific iPad version.  It’s limited to 30 seconds, so it’s not like its a ton of extra work.

Hope this helps someone else out there.

 

 

Annoying Unity3D Omission with iOS Banner Ads

So, Unity provides a nice and easy to use wrapper for iOS banner ads.  This is great and I use it in my ad mediator code (I don’t trust 3rd party mediators… had issues with them all).  Unfortunately, in their wisdom, they left out one little thing… there is no call back when a iAd doesn’t load, so you get a lovely blank ad space – earning you slightly less money than an actual iAd would.

-(void)bannerView:(ADBannerView*)banner didFailToReceiveAdWithError:(NSError*)error
{
    ::printf_console("ADBannerView error: %s\n", [[error localizedDescription] UTF8String]);
    _showingBanner = NO;
    [self layoutBannerImpl];
}

That’s the code they have in iAD.mm when you build an iOS project.

With the simple addition of one line you can get a notification that the ad failed to load and then present another ad from another provider.

-(void)bannerView:(ADBannerView*)banner didFailToReceiveAdWithError:(NSError*)error
{
    ::printf_console("ADBannerView error: %s\n", [[error localizedDescription] UTF8String]);
    _showingBanner = NO;
    UnityADBannerViewWasLoaded(); // Added by CG
    [self layoutBannerImpl];
}

As you can see, I just fire the existing notification system they already have.  The triggered callback just checks to see if _showingBanner is set to ‘NO’ and if it is, then it signifies that no ad was loaded – simple right?

Unfortunately, I have to update this line every time I ‘Replace’ or build a new iOS App – you wouldn’t believe the number of times I’ve forgotten… or maybe you would.

Pretty simple for the folks at Unity to include this in their iOS project template, and they’ve been asked to do so by many different developers, but nothing yet.

GameCenter on iOS Observation

I’ve been working on making an Ad Free version of my Candy Bubble Drop game and decided to use the GameCenter grouped Leaderboards & Achievements so both versions will share them.

This is pretty simple to setup in iTunesConnect, however (and why would I expect anything different) I ran into an issue with the way I had my Leaderboards & Achievements setup.

For the free version, I’d used ‘.Zone1’ as a Leaderboard ID and ‘.Zone1’ as an achievement ID.  The Leaderboard is used to record the best scores from Zone1 and the achievement is set when the player completes all the levels in Zone1.  Even though they have exactly the same ID, this never caused a problem, and I think I’ve done something like this in other Apps.

When I came to make a GameCenter Group, it updates all the IDs by prefixing them with ‘grp.’ and it wouldn’t accept that a Leaderboard and an Achievement have the same ID.  I modified the group achievement IDs, but now I need to code up a hack to modify the ID I submit to match the one I entered in GameCenter.

Morale of the story — DON’T use the same identifier for Leaderboards & Achievements in GameCenter, it might work just fine, but if you ever decide to group it with another App, then you’ll have to end up hacking your code to allow for a different ID.

Candy Bubble Drop updated

Icon-180My Candy Bubble Drop update for iOS is now live.  As everyone who submits something to Apple does, I was hoping for some kind of promotion from them, but nothing.  Oh well, maybe next time.

You can check it out in iTunes by following this link.  Now to make a paid ad-free version along with the Android version.

Quicktime Recording of your iOS device via USB

I’m sure almost everyone out there already knows this, but it’s something I just recently discovered…

I wanted to make a App preview video for the Candy Bubble Drop update to submit to Apple along with the archive.  Did some searching and found a few options to record from an iOS device, but they required me to spend money – let’s face it, that was the last option.

Then I thought it would be better to record directly from the Unity player window, set to the correct resolution, and if I did it on a PC, then I could use FRAPS which I already owned.  A few minutes later and I had the game running on my PC inside Unity with a large player window that mimicked iPad resoultion.  FRAPS was activated and I was able to capture gameplay video, with the bonus of being still in the editor, so I could jump around between levels a lot easier.

From there, I moved the video clips back to my Mac and opened them in Handbrake.  Handbrake Mac has a live preview window and as I needed to trim the recordings to just the iPad size (there were some window decorations, and I made the window a little wider/taller to make sure I had the right rez).  Handbrake Mac allowed me to adjust the trim values and see what I was going to get – nice right?

I exported the videos as .mp4 files and then imported them all into iMovie.  iMovie now has an ‘App Preview’ project window, which allowed me to stitch the videos together and output a MP4 suitable for upload to the App Store.

This is then where I ran into a bit of a hurdle.  The App Store will let you upload a demo video for each device size, actually it requires it.  If you only upload an iPad sized video, then only people previewing your app on the iPad will see the video, you need to upload videos specifically for the iPhone 5, iPhone 6 & iPhone 6s – each of which has their own video size. Eeek!

For iPhone 6s I needed a video resolution of 1080×1920 (my app is portrait), but I couldn’t get the Unity window that large.  For iPhone 6 it needed to be 750×1334, while for iPhone 5 I needed 640×1136.  It turns out these are all the same aspect ratio, so I came up with a plan to record the iPhone 6 video with my PC monitor rotated 90 degrees.  That would let me use an editor window larger than 750×1334 (my monitor is 1920×1200 in landscape) which I could then trim to the correct size with Handbrake.

Once I’d completed that, I was able to use the ‘App Preview’ movie template in iMovie and create the video.  At this point I was pleasantly surprised to discover that iMovie rendered my output as 1080×1920, the size I needed for iPhone 6s.  I had planned to use FFMPEG to upscale the movie, but that wasn’t needed.  From there, it was simple to use Handbrake to resize this high-rez movie down to the other two required formats.

But, here’s the kicker. When hunting for App Preview guidelines/restrictions I found a nugget buried in the documents that Quicktime could use your iOS device as a video/audio source, as long as it was connected to the Mac with a lightning cable.  This was an awesome discovery, now I could play the game directly on my iPhone 6 and my iPad and record the entire session with audio.  This would save a ton of time as I didnt need to crop the videos or re-encode from the PC Avi format to MP4. If only I’d known sooner…