Giter Site home page Giter Site logo

mmplayerview's People

Contributors

millmany avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmplayerview's Issues

POD install

I've tried several ways of installing the pod file but keeps giving me the following errors:

[!] Unable to find a specification for MMPlayerView (~> 3.0.2)
[!] Unable to find a specification for MMPlayerView (= 3.0.2)
[!] Unable to find a specification for MMPlayerView

note: I was trying to install them individually, not all together as it shows above.

Play button disappear

in my app there is a play button. When i click play button mmplayerview.startloadinf fund calling and later i hide play button.

My question is when i click different cell only thumb image is show on before cell.

How can i handle this ?

func playButtonDelegate(at index: IndexPath) {
        if let jlist = self.joinAllAllowedInnoList, !jlist.isEmpty {
            self.mmPlayerLayer.startLoading()
            if let videoKey = jlist[index.row].teaserVideo , !videoKey.isEmpty{
                let cell = joinTableView.cellForRow(at: index) as! JoinCell
                self.getVideoUrl(videoKey: videoKey) { videoURL in
                    cell.playButton.isHidden = false
                    self.mmPlayerLayer.thumbImageView.image = cell.thubnailImageView.image
                    //set video where to play
                    if !MMLandscapeWindow.shared.isKeyWindow {
                        self.mmPlayerLayer.playView = cell.thubnailImageView
                    }
                    //set url prepare to load
                    let url = URL(string: videoURL)
                    jlist.forEach { $0.isPlaying = false }
                    cell.titleView.isHidden = true
                    self.mmPlayerLayer.set(url: url, state: { (status) in
                        switch status {
                        case .failed(let err):
                            let alert = UIAlertController(title: "err", message: err.description, preferredStyle: .alert)
                            alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
                            self.present(alert, animated: true, completion: nil)
                            jlist[index.row].isPlaying = false
                            break
                        case .ready:
                            print("Ready to Play")
                            break
                        case .playing:
                            print("Playing")
                            jlist[index.row].isPlaying = true
                            //cell.playButton.isHidden = jlist[index.row].isPlaying
                            break
                        case .pause,.end:
                            print("End")
                            jlist[index.row].isPlaying = false
                            //cell.playButton.isHidden = jlist [index.row].isPlaying
                            break
                        default: break
                        }
                        
                    })
                    self.mmPlayerLayer.startLoading()
                }
            }
        }
    }

pod: Error installing MMPlayerView

Installing MMPlayerView (3.0.10)

[!] Error installing MMPlayerView
[!] /usr/bin/git clone https://github.com/MillmanY/MMPlayerView.git /var/folders/pr/fhmj14x91td_543s8_cg5b3r0000gn/T/d20180228-8288-1j7qrfg --template= --single-branch --depth 1 --branch 3.0.10

Cloning into '/var/folders/pr/fhmj14x91td_543s8_cg5b3r0000gn/T/d20180228-8288-1j7qrfg'...
warning: Could not find remote branch 3.0.10 to clone.
fatal: Remote branch 3.0.10 not found in upstream origin

LandSpace button

Hi, I put a button to covera cell. When I click button video will be play in fullscreen view
How can I do this ? Any help ?

what I did in CoverA cell

@IBAction func btnFullAction(_ sender: Any) {
        
        let full = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "FullScreenViewController") as! FullScreenViewController
        MMLandscapeWindow.shared.makeKey(root: full, playLayer: self.playLayer!, completed: {
            print("landscape completed")
            //self.playerCollect.isScrollEnabled = true
        })
    }

How to use MMPlayerLayer in Tableview

I have used MMPlayerLayer in tableview cell

mmPlayerLayer.playView = cell.imgView
mmPlayerLayer.set(url: cell.data?.play_Url, state: { (status) in 
})
mmPlayerLayer.startLoading()

Like

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        
        guard let resource = Bundle.main.path(forResource: "video", ofType: "mp4") else {
            print("VIDEO ERROR")
            return
        }
        //
        let url = URL.init(fileURLWithPath: resource)
        
        let cell = self.tableView.cellForRow(at: indexPath) as! VideoCell
        mmPlayerLayer.playView = cell.imgView
        mmPlayerLayer.set(url: url, state: { (status) in
        })
        mmPlayerLayer.startLoading()
        

    }

on scrolling its showing on other cell too. what am i doing wrong?

Play video not working in new viewcontroller.

Hello,

I am trying to play a video in other viewcontroller not in UICollectionview by this method.

func playVideo(urlStr: String){

    self.playerLayer?.stopLoading()
    
    if !MMLandscapeWindow.shared.isKeyWindow{
        mmPlayerLayer.playView = self.ivScoop
    }
    
    // set url prepare to load
    
    mmPlayerLayer.set(url: URL(string: (Constant.URL_VIDEO_SCOOP_END_POINT + urlStr)), state: { (status) in
        switch status{
            
        case .ready:
            print("ready to play")
        case .unknown:
            print("unknown")
        case .failed(let err):
            print("eroror")
        case .playing:
            print("playing")
        case .pause:
            print("pause")
        case .end:
            break
            
        }
    })
}

But it's not working. and status is just unknow .

Please help me.

Thank you very much.

Command failed due to signal: Abort trap: 6. Using Xcode 9 with swift 3.2

Stored value type does not match pointer operand type!
store i64 %1, i32* %14, align 4, !dbg !3254
i32Stored value type does not match pointer operand type!
store i64 %2, i32* %17, align 4, !dbg !3254
i32Stored value type does not match pointer operand type!
store %swift.refcounted* %3, i64* %19, align 4, !dbg !3254
i64:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
:0: note: Broken function found, compilation aborted!
0 swift 0x000000010e0badba PrintStackTraceSignalHandler(void*) + 42
1 swift 0x000000010e0ba1f6 SignalHandler(int) + 662
2 libsystem_platform.dylib 0x00007fffd6aabb3a _sigtramp + 26
3 libsystem_platform.dylib 0x000000010f865551 _sigtramp + 953915953
4 libsystem_c.dylib 0x00007fffd6930420 abort + 129
5 swift 0x000000010aa29fe7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_0::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool) + 551
6 swift 0x000000010e0783fb llvm::report_fatal_error(llvm::Twine const&, bool) + 571
7 swift 0x000000010e0781ba llvm::report_fatal_error(char const*, bool) + 42
8 swift 0x000000010e04e6b6 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) + 54
9 swift 0x000000010dffbaaa llvm::FPPassManager::runOnFunction(llvm::Function&) + 506
10 swift 0x000000010e003609 llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) + 377
11 swift 0x000000010e0033fa llvm::legacy::FunctionPassManager::run(llvm::Function&) + 410
12 swift 0x000000010aba3778 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex, llvm::GlobalVariable, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 5016
13 swift 0x000000010aa2ec18 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 19496
14 swift 0x000000010aa28784 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7716
15 swift 0x000000010a9dd6a8 main + 12248
16 libdyld.dylib 0x00007fffd689c235 start + 1
Stack dump:

How define when video has been loaded?

Is there a completion or something like this for startLoading()?

I have a collectionView. In cell there is a video. When cell is dequeuing the video starts loading. autoPlay is false. I want to manually start the video after it get loaded. How can i achieve that?

Resume immediately when the video already played

Hello Sir.

Thank your for library.

I have an issue , for now I still don't know how to control that. I want to resume video immediately when scroll down or scroll up. (like Facebook) (apply this for the video already playing then pause state).

I have just try to put MMPlayerLayer in each cell then when cell is invisible I set it's pause then play it again when that cell visible but really laggy.

In this library seems to cache the last time of video then init and play with that time. but in this way I need to wait indicator loading.

One more thing. I really want to keep the last thumb when the video pause.

Can you help me.

Thank you so much.

Tableview don't work didSelectRowAt indexPath when i tap on img

I use example MMPlayerView. I have didSelectRowAt indexPath, but this don't work. Before MMPlayerView didSelectRowAt indexPath worked. For show video I use @IBOutlet weak var imgVideo: UIImageView! in class UITableViewCell

then I tried did next:

let tapVideoImgGesture = UITapGestureRecognizer(target: self, action: #selector(tapOnVideoImg(tapGestureRecognizer:))) imgVideo.isUserInteractionEnabled = true imgVideo.addGestureRecognizer(tapVideoImgGesture)

@objc func tapOnVideoImg(tapGestureRecognizer: UITapGestureRecognizer){ print("tap video image") }

the above code does not work

Navigation issue

After navigating back from detail view controller, main collection view doesn't show the video view.

Always get blank black color before play

Hello,

When the video ready to play I always get the blank black color before play video. Can you let me know why.

Thank you so much.

Change the background Of AvPlayer.

Full screen and detail page

Hi there dear sir,
I have an app which is similar to utube.
I want player to play after you present a viewcontroller, and when i rotate full screen, first time it works, after that the full screen doesnt work when i close the presented viewcontroller and open another one, doesnt update the latest video.
How do i approach this?

Here is the code i use on detail page:

  1. This is how i present the player container controller.
 let playerController = storyboard?.instantiateViewController(withIdentifier: "GVPlayerController") as! GVPlayerController
        playerController.videoObjectBasic = videoBasic
       //self.navigationController?.pushViewController(playerController, animated: false)
        self.present(playerController, animated: true)
  1. This is the mmplayer layer, and playerContainer which is a uiview where the player will be shown.
var videoObjectBasic: GVVideoBasic?

   lazy var mmPlayerLayer: MMPlayerLayer = {
       let l = MMPlayerLayer()
       l.cacheType = .memory(count: 5)
       l.coverFitType = .fitToPlayerView
       l.videoGravity = AVLayerVideoGravity.resizeAspect
       l.replace(cover: GVPlayerView.instantiateFromNib())
       return l
   }()

   @IBOutlet var playerContainer: UIView!
  1. Here im adding the observer for container full screen
override func viewWillAppear(_ animated: Bool) {
       super.viewWillAppear(animated)
       NotificationCenter.default.addObserver(forName: .UIDeviceOrientationDidChange, object: nil, queue: nil) { [unowned self] (_) in
           self.landscapeAction()
       }

   }

fileprivate func landscapeAction() {

       if UIDevice.current.orientation.isLandscape {
           let full = self.storyboard?.instantiateViewController(withIdentifier: "GVFullScreenPlayerController") as! GVFullScreenPlayerController
           MMLandscapeWindow.shared.makeKey(root: full, playLayer: mmPlayerLayer, completed: {
               print("landscape completed")
               //                    self.playerCollect.isScrollEnabled = true
           })
       }
   }
  1. And lastly here is the player i load with a link from API
    private func loadPlayer(urlString:String) {
      if !MMLandscapeWindow.shared.isKeyWindow {
           self.mmPlayerLayer.playView = self.playerContainer
       }

       self.mmPlayerLayer.set(url: URL.init(string:urlString)!, state: { (status) in
           switch status {
           case .failed(let err):
               let alert = UIAlertController(title: "err", message: err.description, preferredStyle: .alert)
               alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
               self.present(alert, animated: true, completion: nil)
           case .ready:
               print("Ready to Play")
           case .playing:
               print("Playing")
           case .pause:
               print("Pause")
           case .end:
               print("End")
           default: break
           }
       })
       self.mmPlayerLayer.startLoading()
   }

Basically it doesn't change or load, second video when first video is dismissed.
What im doing wrong ?

Thank you for your time

MMPlayerFromProtocol Not work totally

I have an issue with that.

I have a tabbar with three tabbar items. just call it is A B C

In A viewcontroller I extension MMPlayerFromProtocol
In B viewcontroller I extension MMPlayerFromProtocol

then in viewcontroller B I try to pass Player to another viewController but MMPlayerFromProtocol raised in A

Can you explain why?

Thank you so much.

Logo proposal

Hi @MillmanY I am a graphics designer and i would like do contribute to your nice project by designing a logo for it as a gift for free. If you will permit me i will begin immediately.. Best regards!

  • Tobaloidee

Video resolution

Video does not fit in the container view it gets cropped either by width or by height.
I want to play video as its captured resolution is.

How to stop play video, if there is not only video types in collectionView there are images types also?

Hi am also using the same way to Play Video in Collection View. There is a list of images and videos showing in collection view.

 [ Video type ]
 [ Image type ]
 [ Video type ]
 [ Video type ]
 [ Video type ]
 [ Image type ]
 [ Image type ]
 
 fileprivate func updateCell(at indexPath: IndexPath) {
 
 if let cell = self.collectionView!.cellForItem(at: indexPath) as? TimelineFeedCell {
 // this thumb use when transition start and your video dosent start
 
 let postDict = self.arrayPostData[indexPath.item]
 
 print(indexPath.item)
 
 if postDict.video_flag == 0 {
 
 mmPlayerLayer.playView = nil
 mmPlayerLayer.player?.pause()
 mmPlayerLayer.playUrl = nil
 
 } else {
 
 mmPlayerLayer.thumbImageView.image = cell.postImageView.image
 // set video where to play
 if !MMLandscapeWindow.shared.isKeyWindow {
 mmPlayerLayer.playView = cell.postImageView
 }
 
 // set url prepare to load
 mmPlayerLayer.set(url: URL(string: cell.postModelInfo?.image_url ?? ""), state: { (status) in
 switch status {
 case .failed(let err):
 print("err", err)
 case .ready:
 print("Ready to Play")
 case .playing:
 print("Playing")
 case .pause:
 print("Pause")
 case .end:
 print("End")
 default: break
 }
 })
 }
 }
 }
 
 Am using your function but Still am not able to stop the previous cell of video. Video is still playing but my current cell is of image. How can I resolve this issue. Please Help me

Sound not working

Hello,
I'm using MMPlayerView to play video url , video is playing fine but sound not working ,not able to hear sounds so what should I do to get sound in device.

Thumb Issues

I am Using Player in tableViewCell when next video is playing then previous Video thumb is shown in Player. can you suggest any solution or improve in library.

Full Screen Mode

Hi, firstly thanks for this awesome library.
My question is I added a pull screen button to CoverA.xib and set action.

What should i write in my custom full screen button action ? THANKS. :)

When going to landscape still loading previous video in memory

Hello,
I have arranged a controller where I select a certain video and then I pass the correct index path to play it.
Everything is fine but when I go to landscape and then go back to the first controller and select a different video, it correctly plays in portrait, but when I switch again to landscape, the extension shows the previous video (the very first one). When I switch back to portrait I see the correct one (like second or third video selected).

It clearly is something related to the previous index not being released in the landscape controller. And I am sure it is MY fault.

But eventually you can help me figure out where I can/I am supposed to release that information... Thanks so much!
Cristiano

How to remove push transition

Hello,

I want to remove custom transition to other viewcontroller that I don't want pass the video.

Because now if I don't implement PassViewToProtocol in other viewcontroller I get frozen. how can I fix that issue.

Thank you so much.

How to stop video ?

when video is loading from url and dismiss view controller but after some time video is play in background. how to fixed is this.

Memory leak when select full screen

ViewController
CollectionView
CollectionViewCell

Play full screen video mode from collectionViewCell then pop this viewcontroller, I noted this viewcontroller doesn't deinit called.

But if I don't select full screen from collectionview then pop this viewcontroller will raise the deinit function.

Can you check.

screen shot 2018-08-14 at 4 02 34 pm

How can i play with specific time

How can I play MMPlayerview with the Specific seek time? I'm playing video in the TableViewcell I need to have videos play where they are paused while scrolling. So I'm asking where can I do that in the code?

Fullscreen

Hi,

Thank you very much for your work. How can I set mmplayer to fullscreen?

How to reach coverA Cell in tableview ?

Hi, I want to put a view in cover a cell. In this view, I wan to put a label.
My aim is this label will be my video name.

My question is how can i set video name dynamically using coverA cell ? thanks.

stopLoading() not work

Hello.

The video is loading then I want to stop loading but seems it's don't work. I already call stopLoading() but when the video was loaded it will be playing.

Change video while in full screen

Can I change video url and video, while i am in full screen, basically if i have autoplay and i am in full screen to go from one video in next without the need to leave full screen?
Thank you @MillmanY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.