VLC FW 3.0 Swift 3.0

iOS, iPad, iPhone, tvOS specific usage questions
Elreys
New Cone
New Cone
Posts: 1
Joined: 13 Nov 2017 22:10

VLC FW 3.0 Swift 3.0

Postby Elreys » 13 Nov 2017 22:19

Hello Guys,

I like to implement VideoAspectRatio and Crop,
but I dont understand what I need to do, I found the official Documentation,

@property (NS_NONATOMIC_IOSONLY) char *videoAspectRatio;

/**
* Set/Get current video aspect ratio.
*
* param: psz_aspect new video aspect-ratio or NULL to reset to default
* \note Invalid aspect ratios are ignored.
* \return the video aspect ratio or NULL if unspecified
* (the result must be released with free()).
*/

var videoAspectRatio: UnsafeMutablePointer<Int8>! { get set }

How I can implement UnsafeMutablePointer<Int8>! in Swift the Template shows this:

Code: Select all

if ([_aspectRatios[_currentAspectRatioMask] isEqualToString:@"FILL_TO_SCREEN"]) { UIScreen *screen = [UIScreen mainScreen]; float f_ar = screen.bounds.size.width / screen.bounds.size.height; if (f_ar == (float)(640./1136.)) // iPhone 5 aka 16:9.01 _mediaplayer.videoCropGeometry = "16:9"; else if (f_ar == (float)(2./3.)) // all other iPhones _mediaplayer.videoCropGeometry = "16:10"; // libvlc doesn't support 2:3 crop else if (f_ar == .75) // all iPads _mediaplayer.videoCropGeometry = "4:3"; else if (f_ar == .5625) // AirPlay _mediaplayer.videoCropGeometry = "16:9"; else NSLog(@"unknown screen format %f, can't crop", f_ar); NSLog(@"FILL_TO_SCREEN"); return;

Please I need you help

Thanks :)

bubu?
Developer
Developer
Posts: 371
Joined: 20 Jun 2017 15:29
Operating System: macOS, iOS

Re: VLC FW 3.0 Swift 3.0

Postby bubu? » 14 Nov 2017 11:20

Hello,

I'm not sure to understand it correctly but here it goes.
If you want to change the aspect ratio or crop in Swift, you could do something like this:

Code: Select all

self.mediaPlayer.videoAspectRatio = UnsafeMutablePointer<Int8>(mutating: "insert_wanted_aspect_ratio")

mediaPlayer being a VLCMediaPlayer instance.
Soomin Lee - bubu


Return to “VLC for iOS, iPadOS and Apple TV”

Who is online

Users browsing this forum: No registered users and 46 guests