How to show video files in UITableView with image of video? - mpmovieplayercontroller

I could access mediafiles with MPMediaPickerController, I need to list down all videos I selected from picker.
MPMoviePlayerViewController is being used and I have added a player to every cell, but I couldn't use it for more than one cell. I think! on selecting the UITableViewCell on UITableView, we need to use this. But how to show the thumbnail or image of video (footprint) in tableview for all cells.
Goal: Once I list down with footprint, on selecting I use MPMoviePlayerViewController to play selected.
Thanks,
Venkatarao

Store the ALAsset URL of selected videos
Load the UITableView wit the
all selected videos thumbnail(using ALAsset URL).
UITableView didSelectRowAtIndexPath,
retrive the ALAsset url from your local directory and play it via
MPMoviePlayerViewController.

The tasks are:
Listing
Playing
Approaches:
We could list if we have access to ALAsset(through assetURL), we
could get the thumbNail and use on UITableView. We could put custom
play buttons on the views. Upon selection we use MPMoviePlayerViewController to organize the file
from selected assetURL
Using UIWebView, we embed UIWebview on UITableViewCell and pass on assetURL. Specify embed type un HTML string for webWiew as application/x-shockwave-flash and it will use MPMoviePlayerViewController to organize file upon selection.
Thanks&Regards,
Venkatatarao N

Related

Resizing image to fit Ui Image View in xcode storyboard

I am trying to fit an image to fit the entire of the Ui Image View. I want to do this because I want to round my image and it does not work because the image is smaller than the entire view. So rounding it rounds the outside of the image and is not visible. I have tried to add constraints but that does not seem to have workout.
Here is an image of what I am trying to do:
https://i.stack.imgur.com/mIGow.png
The problem images:
https://i.stack.imgur.com/LGDyx.png
https://i.stack.imgur.com/K3RVZ.png
OK - the problem is that you don't understand the Xcode interface.
When you have added a UIImageView, set its image, and then select it, you see this:
If you click the image view again, Xcode shows an additional "highlight" outline:
That has nothing to do with how it will look when you run your app.
Regarding the screen-cap from the video you are watching... You either didn't notice, or forgot, two things:
it's a tutorial for SwiftUI - the screen-caps you've posted for what you're trying to do is from a UIKit based app.
at 17:20 of Part 1 of that series, the author explains how he is setting the corner radius.
To get what you want with UIKit, you need to write some code to give the image view rounded corners. To have it show up at design-time, you need to use an #IBDesignable image view subclass.
Here's a very basic example:
#IBDesignable
class RoundedImageView: UIImageView {
override func layoutSubviews() {
layer.cornerRadius = 20
}
}
If you set the Custom Class of your image view to RoundedImageView, and then either select either Editor -> Refresh All Views or have Editor -> Automatically Refresh Designable Views checked, you'll see this:

Image gallery in CollectionViewController

I am recently working on an iphone app in xcode 6 and created an image gallery in CollectionViewControllor, I need help about 2 things;
first I need to get a fullscreen view of the Images I have in each cell,
second How I can update the images dynamically
I really appreciate your help in advance,
A few suggestions on the two questions in this post
How to show image in full screen? Depends how you want it to show to user. One way could be to make a new view controller having a UIImage. Once you tap on the image in collection view (using didSelectItemAtIndexPath), you can pass the image to new controller which displays it.
To update the images in real time, I assume you have images stored somewhere remotely and want to fetch those in background and update the collection view. Following article may help over here
http://www.raywenderlich.com/19788/how-to-use-nsoperations-and-nsoperationqueues
Hope it helps.

UICollectionView embed youtube video still plays in another view

I have a video playing in a UICollectionView cell, basically a UIWebView embed with a youtube link. When i click on another cell which goes to another view, the video is still playing in the background. Since I have so many cells, its really hard to keep track of the video playing. Also when you tap a cell with a UIWebVIew (embed youtube video) it doesn't really detect the didSelectItemAtIndexPath.
Any suggestions would be helpful thanks!
Two thoughts.
Checkout NSNotificationCenter, you can maybe create an event when you press play and then watch for it.
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/Reference/Reference.html
Another option is to not play the video in the collection view, but rather segue to another view that plays the video. I'm not sure if this is too different from the functionality you want, but it seems simpler.

how to set the IKImageBrowserView with variable cell sizes?

I am developing a tool which will allows the user to import the video clips and make the movie from those video clips.
To represent the imported video clips i have created the IKImageBrowserView and add the frameimage of the videoclip as a Thumbnail image. up to here everything is working.
But now i wanted to display the thumbnail image size based on the video clip duration. i.e each and every thumbnail image have the different size based on the duration. (i wanted to show the thumbnail image width going to be changed based on the duration of the video clip.
If i use [imageBrowser setCellSize:];then it will affect all the thumbnail sizes. but i wanted to apply different size for each and every thumbnail.
Can anybody help me to solve this problem?
if IKImageBrowserView is not the best suitable for my problem then please suggest me the best control to solve my problem.
The best solution will be implementing your own IKImageBrowserCell subclass for your custom IKImageBrowserView
First of all, you need to subclass the IKImageBrowserView and override newCellForRepresentedItem:
In this method, return an instance of your own subclass of IKImageBrowserCell.
In your subclass of IKImageBrowserCell, override the following methods to modify the layout dynamically based on the represented video clip:
(To retrive the video clip data model which should conform to the informal protocol, IKImageBrowserItem, use -[IKImageBrowserCell representedItem])
- (NSRect) imageContainerFrame;
- (NSRect) imageFrame;
- (NSRect) selectionFrame;
- (NSRect) titleFrame;
- (NSRect) subtitleFrame;
- (NSImageAlignment) imageAlignment;
There is also a demo project on ADC which can be found at
http://developer.apple.com/library/mac/#/legacy/library/samplecode/ImageKitDemo/Introduction/Intro.html

How to check the positions of different controls in iPhone

How to check some place is already reserved by some controls before adding a new control to the view.
I have added some buttons in the UIImageView and I want to display some images in a label which I'm getting in a random size from the server.I want to place those images over the empty places in the same view.
After adding the first image in some empty place,how could I know that this place is reserved and I have to place the second image in some other placeand the images and buttons should not overlap over each other.
Can somebody please help me ?
Try using CGRectIntersectsRect on the control's frame property (which it inherits from UIView).
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CGGeometry/Reference/reference.html
I don't believe this will work for rotated views though...hm.
See this image for reference: http://cl.ly/3T3d3w0D2I2Q1w1r0m46

Resources