how to change default receiver image size on tv screen - ios

I altered the sample code and set the value, and then found that the default receiver image size has no change on tv. how to change that?
GCKMediaMetadata *metadata = [[GCKMediaMetadata alloc] init];
if (thumbnailURL) {
[metadata addImage:[[GCKImage alloc] initWithURL:thumbnailURL width:200 height:100]]; //<=== alter here, try to change "width:200 height:100" to "width:720 height:960", but there's no change.
}
GCKMediaInformation *mediaInformation =
[[GCKMediaInformation alloc] initWithContentID:[url absoluteString]
streamType:GCKMediaStreamTypeNone
contentType:mimeType
metadata:metadata
streamDuration:0
customData:nil];
[self.mediaControlChannel loadMedia:mediaInformation autoplay:autoPlay playPosition:startTime];

It is not clear what you are trying to achieve; if you want the image to be differently sized on your TV, then yo have to make changes in your receiver, in the <img/> tag to adjust to the size that you want.

You cannot customise the UI with a default media receiver. Use the styled media receiver instead and specify the size of your image in the css.

Related

RTCVideoTrack shows stretched WebRTC

I am using core WebRTC framework and rendering my local stream in IPhone full screen mode. Unfortunately, my video shows stretched, doesn't show like video view in camera app.
I tried to add aspect ratio in RTCMediaConstraints and also used adaptOutputFormatToWidth method to fix the output.
NSDictionary* mandatoryConstraints;
/* want to calculate aspect ratio dynamically */
NSString *aspectRatio = [NSString stringWithFormat:#"%f",(double)4/3];
if (aspectRatio) {
mandatoryConstraints = #{ kRTCMediaConstraintsMaxAspectRatio:
aspectRatio};
}
RTCMediaConstraints *cameraConstraints = [RTCMediaConstraints alloc];
cameraConstraints = [cameraConstraints initWithMandatoryConstraints:mandatoryConstraints optionalConstraints:nil];
RTCAVFoundationVideoSource *localVideoSource = [peerFactory avFoundationVideoSourceWithConstraints:mediaConstraint];
[localVideoSource adaptOutputFormatToWidth:devicewidth:devicewidth fps:30];
In below link, the difference between camera video view and my app call video view is shown
https://drive.google.com/file/d/1HN3KQcJphtC3VzJjlI4Hm-D3u2E6qmdQ/view?usp=sharing
I believe you are rendering your video in RTCEAGLVideoView, which require adjustment for size, you can use RTCMTLVideoView in place of RTCEAGLVideoView.
and if you want to use RTCEAGLVideoView, use RTCEAGLVideoViewDelegate method.
- (void)videoView:(RTCEAGLVideoView *)videoView didChangeVideoSize:(CGSize)size;
this method will give you correct size of the video.
(For Swift) -> Use RTCMTLVideoView and set videoContentMode
#if arch(arm64)
let renderer = RTCMTLVideoView(frame: videoView.frame)
renderer.videoContentMode = .scaleAspectFill
#else
let renderer = RTCEAGLVideoView(frame: videoView.frame)
#endif

App icon is not showing in CallKit UI

I have configured my Provider Configuration for CallKit iOS. In which I have also set 'iconTemplateImageData' for displaying app icon in CallKit UI. But app icon is not showing. It shows a white square box.
Provider Configuration Code:
CXProviderConfiguration *configuration = [[CXProviderConfiguration alloc] initWithLocalizedName:[NSString stringWithFormat:#"%#\n", _title]];
configuration.maximumCallGroups = 1;
configuration.maximumCallsPerCallGroup = 1;
UIImage *callkitIcon = [UIImage imageNamed:#"AppIcon"];
configuration.iconTemplateImageData = UIImagePNGRepresentation(callkitIcon);
_callKitProvider = [[CXProvider alloc] initWithConfiguration:configuration];
[_callKitProvider setDelegate:self queue:nil];
_callKitCallController = [[CXCallController alloc] initWithQueue:dispatch_get_main_queue()];
I have used AppIcon images in 'Images.xcassets' with sizes: -
1x: 40*40, 2x: 80*80, 3x: 120*120
Please help why my app icon is not showing.
Thanks in advance.
This is likely because you are using your AppIcon image, which is a fully opaque image, i.e. no part of that image is transparent or has alpha=0.
To get the desired effect, you have to use a different image which is partly (or mostly) transparent. The native in-call UI will only use the alpha channel of the image you provide, so it ignores colors. I suggest following the example in the Speakerbox sample app and providing a secondary PNG image in your image asset catalog with transparency.
You need to use below code in order to set app name and app icon for incoming VOIP calls
let localizedName = NSLocalizedString("App-Name", comment: "Name of application")
let providerConfiguration = CXProviderConfiguration(localizedName: localizedName)
providerConfiguration.iconTemplateImageData = UIImage.init(named: "appicon-Name")?.pngData()
Note: Your app icon must be transparent. result will be like in below image

facebook full screen picture

I'm trying to get a profile picture and show it in full screen in iOS
Tried using the object FBProfilePictureView, I can't seem to be able to customize the size of the image, it's always the same maximum size
If I try changing the image with other profileIDs, I get different sizes for different profiles
Also tried
uPhoto.pictureCropping = FBProfilePictureCroppingSquare;
But it doesn't make anything better
Should I be using an UIImageView and load the data from a URL like this
https://graph.facebook.com/someuser/picture?width=XXX&height=YYY
Or are there better options ?
FBProfilePictureView allocates a UIImageView in its implementation. There is nothing you can set on FBProfilePictureView that will change the way it scales the UIImageView. So, yes you could allocate your own UIImageView and load a URL. The correct way to get the URL is like this:
NSDictionary *imageQueryParam = #{#"type":#"large"};
NSString *graphPath = [NSString stringWithFormat:#"%#/picture",self.profileID];
FBRequest *fbRequest = [[FBRequest alloc] initWithSession:nil graphPath:graphPath parameters:imageQueryParam HTTPMethod:nil];
FBRequestConnection *requestConnection = [[FBRequestConnection alloc] init];
[requestConnection addRequest:fbRequest completionHandler:nil];
NSURL *url = requestConnection.urlRequest.URL;
This is adapted from my updated version of FBProfilePictureView... DBFBProfilePictureView which was based on Facebook's original.

Setting Move and Scale Box for iOS

I have seen several apps that after you take a picture, it shows a view for Move and Scale your picture, with a box showing what the resulting image will look like. My app takes a picture the user takes or picks from library, and adds it to a PDF file. I need this file to be a certain size to fit on the PDF, so I need to set the move and scale box accordingly, but I cannot find any documentation on how to do this. Any suggestions?
Just set the UIImagePickerController instance's allowsEditing to YES.
_imagePickerController = [[UIImagePickerController alloc] init];
...
_imagePickerController.delegate = self;
_imagePickerController.allowsEditing = YES;
The UIImagePickerController picker ONLY performs 320x320 cropping.
Try using this: https://github.com/gekitz/GKImagePicker (GKImagePicker)
Sample Code:
self.imagePicker = [[GKImagePicker alloc] init];
self.imagePicker.cropSize = CGSizeMake(320, 90);
self.imagePicker.delegate = self;
[self presentModalViewController:self.imagePicker.imagePickerController animated:YES];

Change lock screen background audio controls text?

I have an iOS app that streams background audio using AVAudioSession. It is working correctly, but I am curious, is there any way to change the text on the lock screen audio controls? Right now it simply displays the name of my app, but I would like to change it to the name of the track.
Additionally, the multi-tasking bar has no text under the controls- is there a way to add the track name there, as the iPod app does?
iOS 5 now supports setting the track title as well as an album art image in both the lock screen and the remote playback controls (the controls you get when you double-click the home button and swipe right). Take a look at the
MPNowPlayingInfoCenter class. Of course, to maximize compatibility, you'd want to test whether MPNowPlayingInfoCenter is available, by doing something like:
if ([MPNowPlayingInfoCenter class]) {
/* we're on iOS 5, so set up the now playing center */
UIImage *albumArtImage = [UIImage imageNamed:#"HitchHikersGuide"];
albumArt = [[MPMediaItemArtwork alloc] initWithImage:albumArtImage];
NSDictionary *currentlyPlayingTrackInfo = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:#"Life, the Universe and Everything", [NSNumber numberWithInt:42], albumArt, nil] forKeys:[NSArray arrayWithObjects:MPMediaItemPropertyTitle, MPMediaItemPropertyPlaybackDuration, MPMediaItemPropertyArtwork, nil]];
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = currentlyPlayingTrackInfo;
}
here it is in swift! (no need to check for iOS 5 and up anymore)
let albumArt = MPMediaItemArtwork(image: UIImage(named:"HitchHikersGuide"))
let albumDict = [MPMediaItemPropertyTitle: "Life, the Universe and Everything", MPMediaItemPropertyPlaybackDuration: 42, MPMediaItemPropertyArtwork: albumArt]
MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo = albumDict

Resources