MobileVLCKit and VLCKit, part 3

This is part of an article series covering VLC’s Objective-C framework, which we provide to allow inclusion of all its features in third party applications as well as VLC for iOS and Apple TV.

Previously published:

Today, we will discuss thumbnailing of video content. We need to differenciate two key aspects: saving still images of a currently playing video (snapshot) and previewing media stored somewhere without being played (thumbnail). While either way, VLCKit will open the resource, decode the bitstream and provide you with a image, performance and usability will differ.

Thumbnailing

Let’s start with thumbnailing a non playing media source, which can be stored locally or remotely.

@implementation DummyObject <VLCMediaThumbnailerDelegate>

- (void)workerMethod
{
    // 1
    NSURL *url = [NSURL urlWithString:@""];
    VLCMedia *media = [VLCMedia mediaWithURL:url];

    // 2
    VLCMediaThumbnailer *thumbnailer = [VLCMediaThumbnailer thumbnailerWithMedia:media delegate:self];

    // 3
    CGSize thumbSize = CGSizeMake(800.,600.);
    thumbnailer.thumbnailWidth = thumbSize.width;
    thumbnailer.thumbnailHeight = thumbSize.height;

    // 4
    [thumbnailer fetchThumbnail];
}

- (void)mediaThumbnailer:(VLCMediaThumbnailer *)mediaThumbnailer didFinishThumbnail:(CGImageRef)thumbnail
{
    // 5
    if (thumbnail) {
        UIImage *thumbnailImage = [UIImage imageWithCGImage:thumbnail scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp];
        if (thumbnailImage) {
            // TODO: do something with the thumbnail!
        }
    }
}

- (void)mediaThumbnailerDidTimeOut:(VLCMediaThumbnailer *)mediaThumbnailer
{
     // TODO: Show a reaction
}

@end
  1. We need to create a NSURL instance along with its VLCMedia representation. Note that the URL may point to both a local or a remote resource.
  2. We create the thumbnailer instance for our media and point to ourselves as a delegate to receive the thumbnail.
  3. We define the size of the resulting thumbnail.  If width and height are set to zero, the video’s original size will be used. If you set either width or height to zero, the aspect-ratio is preserved.
  4. Finally, we call the thumbnailer’s worker function.
  5. Asynchronously, after about two to twenty seconds, we will receive a response from the thumbnailer to the delegate. It is important to check the thumbnail for NULL before trying to bridge it to a UIImage or NSImage as well as afterwards as the translation can fail. That’s all.

You might be wondering how the thumbnailer decides which frame to return. This is based on a more complex algorithm currently depending on the media’s duration and availability of key frames. Future versions may also analyze the image content.
You can overwrite this algorithm with the thumbnailer’s snapshotPosition property (with a 0.0 to 1.0 range).

Snapshots

The VLCMediaPlayer class includes a very basic API, which allows the creation of an infinite number of snapshots during playback, which will be asynchronously stored as local files. The size parameters follow the same pattern as for the thumbnailer.

- (void)workerMethod
{
    // ...
    [_mediaplayer saveVideoSnapshotAt:(NSString *)path withWidth:(int)width andHeight:(int)height];
    // ...
}

As soon as the snapshot was stored, a VLCMediaPlayerSnapshotTaken notification is emitted and mediaPlayerSnapshot: is called on the media player’s delegate. Note that the delegate call is available on iOS and tvOS only.
As a convenience starting in VLCKit 3.0 on iOS and tvOS, the media player class exposes the lastSnapshot and snapshots properties, which provide a UIImage instance of the last shot as well as a list of files of the taken shots.

That’s all for today. Enjoy using VLCKit!

VLCKit 3.0

10 days ago, we published VLC media player 3.0 for all platforms. It’s the first major release in three years and brings a huge number of features, improvements and fixes. Get an overview here and the full changelog there.

For VLCKit, we improved performance and memory management, added new APIs and you get all improvements from the underlying libvlc including full support for decoding H264 and H265 using VideoToolbox in hardware. Instead of using all cores of your iPhones CPU at 100%, decoding a 4K video uses less than 20%.
Further you can look at all aspects of a 360° video with touch gesture based controls, discover and browse shares on your network with UPnP, NFS, FTP, SFTP and SMB and more.

As you remember, we published VLC for Apple TV in January 2016, but so far, we never made VLCKit available on tvOS. In addition to MobileVLCKit for iOS, we now introduce TVVLCKit for tvOS!

For macOS, iOS and tvOS, VLCKit 3.0 is available through Cocoapods as a precompiled binary under the LGPLv2.1 license. You can find the source code on our website – contributions welcome!

We are looking forward to all your feedback and the apps deploying VLCKit to deliver multimedia to their users.
Do you want to learn more about integrating VLCKit? Have a look at the tutorials I wrote not too long ago (Part 1, Part 2).

So what did we change in VLCKit, API-wise? Continue reading VLCKit 3.0

VLC for iOS, version 2.7.0

Today, we will release a new major version of VLC for iOS. Note that due to adapted review guidelines, it is branded “VLC for Mobile” on the iOS App Store now.

We have been working on this update for the last few months, so it adds a lot of features:

  • full iOS 9 support incl. split screen and iPad Pro
  • re-written Apple Watch app for watchOS 2
  • system-wide search for content stored locally within the app using “CoreSpotlight”
  • Touch ID support to unlock the app
  • full support for Right-To-Left languages

On the playback and networking side, we added

  • support for SMB  file servers (Windows shares)
  • highly improved subtitles rendering with font fallback for non-western languages
  • desktop quality SSA subtitles rendering (initially introduced in 2.6.6)
  • list of recently played network streams is shared across devices using iCloud
  • stored login credentials for servers is shared across devices using iCloud Keychain
  • stored login credentials for cloud services are shared across devices using iCloud Keychain

This release includes a lot of UI improvements, bug fixes and last but not least a newly designed sidebar menu!

Finally, this release drops support for iOS 6.1. VLC now requires iOS 7.0 or later.

This major update is the result of 4 months of work and I would like to thank TobiasCarola and Pierre for their dedication to make this possible.

Stay tuned, we have more exciting things in the pipeline, which we will happily present very soon.

VLC for iOS 2.5.0

Today, we released version 2.5.0 of VLC for iOS with a strong focus on cloud integration. We added support for iCloud Drive, box.com and OneDrive. As part of iCloud Drive, you can have access to any cloud storage enabled app on iOS 8 and later. For box.com and OneDrive, we added native support, which allows us direct streaming from the cloud without having the user download a media first.

Furthermore, we cleaned-up the playback experience matching recent changes in VLC for Android and added the full 10-band equalizer known from VLC’s desktop ports. While reworking playback, we also integrated support for titles and chapters included in a few Matroska / MKV and MP4 files. Due to popular request, you can also lock the UI and rotation during playback.

One last thing: you can share your media library between multiple devices on the same local network now! If you enable WiFi sharing and keep VLC active, it will appear in the “Local Network” tab of all iOS devices running VLC supporting both device to device streaming as well as downloads.

Finally, we added a couple of new translations to Portuguese (Portugal), Portuguese (Brazil), Khmer, Faroese, Belarusian, Serbian (Latin), Tamil and Afrikaans along with the usual set of bug fixes and minor improvements.

We hope you like this new version as much as we do.

VLC for iOS 2.4.0 & 2.4.1

After a 5 month hiatus and a couple of delays in between, we are very happy to release version 2.4.1 of VLC for iOS to the general public today. Please see our press release for cross-platform information.

As an introductory remark, make sure to get the legitimate version of VLC. There are a number of clones on the iOS App Store right now, which violate both our copyright and our trademarks, include advertisement and usually charge $1 to $5 per download. We sent 39 DMCA take down notices against 48 apps over the cause of the last 12 months and in the end, we always succeeded. However, this can take up to 3 months, even for seemingly obvious violations.

As a consequence to those continued violations, VLC for iOS’s source code repository will no longer be publicly accessible, but archives of the stable releases only.

So, what’s new in VLC for iOS?

  • Support for iPhone 6 and 6+
  • Native support for Plex using their custom protocol
  • File Sharing with third party apps
  • Media library search
  • Custom URL scheme based on x-callback-url
  • Greatly improved UPnP support
  • In addition to uploading media via WiFi, you can also download all the media stored within VLC using a simple web browser
  • Streaming and folder support for Google Drive
  • Flat folder synchronization via iTunes
  • Options for default playback speed and FTP text encoding
  • On-the-fly audio and subtitles track synchronization
  • And a large number of small features, improvements and bug fixes as well as a new translation to Traditional Chinese.

This release removes support for Dolby Digital (AC-3), Dolby Digital Plus (E-AC-3) and Dolby TrueHD (MLP) for the foreseeable future due to a content dispute with Dolby Laboratories, which could not be resolved in a different way.

We are very happy with this major version of VLC for iOS and hope that you’ll like it as much as we do. Further, we are excited about the things we have in our pipeline for the forthcoming releases. A first beta of version 2.5 will be released to our testers today.

upnpx 1.3.0

When I started to work on VLC for iOS last summer, it quickly became apparent that it would need to support playback from local media servers announced over the UPnP protocol. I came across a Objective-C++ library named upnpx which suited my use case nicely and which included broad support for all the various UPnP dialects.

Regrettably, upnpx was not maintained anymore since a few months, so I started a private fork within VLC for iOS and eventually moved on to github. Nowadays, my fork is officially endorsed by the original developer Bruno Keymolen.

This week, I did a first release of upnpx since the fork. Version 1.3.0 includes full support for iOS 8 and the 64bit runtime as well as fixes to a lot of logical runtime bugs and crashes. Additionally, it adds new APIs for MediaServer1ItemObject, BasicUPnPDevice, as well as server notifications.

I’m particularly happy about the fact that 8 people contributed to this fork and several hundred people are deploying it in their apps.

So, please get the tarball or add it through CocoaPods, deploy it in your app and report any issues or feature requests you might have!  Let’s see where this goes!