iOS seamless video loop using AVPlayer

I’ve been lately hacking a new app, Fireplace Deluxe for the new Apple TV thingy, and had to deal with looping videos.

The usual way to implement this is getting a notification for AVPlayerItemDidPlayToEndTimeNotification and rewind the video. But this introduces some milliseconds of lag and give us some undesired hiccups.

There is not much info about this but a nice way to solve the issue is by using the AVQueuePlayer and inserting videos in the queue indefinitely as long as they are being played.

This will render a nice seamless video loop without annoying hiccups.

#import <UIKit/UIKit.h>
@import AVKit;

@interface VideoViewController : AVPlayerViewController

#import "VideoViewController.h"

@implementation VideoViewController
    NSURL* videoURL;
    AVQueuePlayer* queue;

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *resourceName = @"";
    NSString* movieFilePath = [[NSBundle mainBundle]
                               pathForResource:resourceName ofType:nil];
    videoURL = [NSURL fileURLWithPath:movieFilePath];
    AVPlayerItem *video = [[AVPlayerItem alloc] initWithURL:videoURL];
    queue = [[AVQueuePlayer alloc] initWithItems:@
    video = [[AVPlayerItem alloc] initWithURL:videoURL];
    [queue insertItem:video afterItem:nil];
    self.player = queue;
    self.showsPlaybackControls = FALSE;

    [self.player play];
    NSNotificationCenter *noteCenter = [NSNotificationCenter defaultCenter];
    [noteCenter addObserverForName:AVPlayerItemDidPlayToEndTimeNotification
                usingBlock:^(NSNotification *note) {
                    AVPlayerItem *video = [[AVPlayerItem alloc] initWithURL:videoURL];
                    [queue insertItem:video afterItem:nil];


Gearsystem Emulator

So this is my latest project.

After finishing and polishing my Game Boy emulator I wanted a new challenge. Something a little bit more complex.

I tried the Master System and to my surprise I found that it is rather easy to emulate. The CPU (Zilog Z80) is somewhat harder but the system is quite simple compared to the Game Boy and Game Boy Color. Most games aren’t very sensitive to timing and the VDP is easy to implement.

So after some weeks of work I have it running most games flawlessly.

I made it multi-platform so it can run on iOS, Windows, Linux, Mac OS X and Raspberry Pi.

You can get it here:

And now what? NES maybe?




To me, DevOps is a label that describes a situation where there are no walls, no gates, no transitions, and no ceremony between Development and Operations.

They are seamlessly integrated (when viewed from “above”) into a single, value delivering, IT entity. From within, there may be individuals who specialize on “one side or the other,” but even those individuals interface seamlessly and directly without the need for an intermediary.

Most importantly (in my humble opinion) DevOps means that everyone—from Jr Analyst, to Mid Dev, to Sr. Test, to Director of IT—is equally responsible and accountable for the product from inception through retirement, meaning the Devs are just as likely to be maintaining the system in Prod as the Sys Admins are, to be doing configuration testing in the Dev Environment.

Packt 2011 Open Source Awards

The 2011 Open Source Awards was launched on the 1st week of August by Packt, inviting people to visit and submit nominations for their favorite Open Source project. Now in its sixth year, the Awards continue in its aim of encouraging, supporting, recognizing and rewarding all Open Source projects.

The 2010 Open Source Award Winners included the Open Source Content Management System (CMS) Award winner CMS Made Simple, Open Source JavaScript Libraries Award winner jQuery and Pimcore the winner of the Most Promising Open Source Project Award.

The 2011 Awards will feature a prize fund of $24,000 with several new categories introduced and the vote of the public becoming more influential.

Packt has opened up nominations for people to submit their favorite Open Source projects for each category at The top five in each category will go through to the final, which begins mid-September.