Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Renewal of player module focusing on easy use o...

Renewal of player module focusing on easy use on LINE iOS.

LINE DevDay 2020

November 26, 2020
Tweet

More Decks by LINE DevDay 2020

Other Decks in Technology

Transcript

  1. Things to be Observed for Playback Properties (AVPlayerItem) status isPlaybackLikelyToKeepUp

    isPlaybackBufferEmpty isPlaybackBufferFull ... Notifications AVPlayerItemDidPlayToEndTime AVPlayerItemFailedToPlayToEndTime AVPlayerItemNewAccessLogEntry AVPlayerItemNewErrorLogEntry kCMTimebaseNotification_EffectiveRateChanged ...
  2. Processing Playback Player Status loading Loading Asset idle Setting Asset

    finished Playback Finished error pending Preloading Finished buffering paused playing › Clearer - Flow of playback status › Less effort - Observing only one property & handling in one place › Easier - Maintaining player module
  3. › Control View › Fullscreen View Controller › Fullscreen Transition

    › Equalizer Image View › Cover Image View Commonly using UI Components
  4. Providing Default UI Components // Setting player to UI Components

    rendererView.player = player coverImageView.player = player // Setting to use default player control view controlView.attach(to: rendererView) controlView.componentInsets = UIEdgeInsets( top: 0, left: 0, bottom: 0, right: 30 ) controlView.attachToContainerView(with: button) // Presenting Fullscreen View Controller let fullscreenVC = LineMediaPlayerViewController() let transition = PlayerViewControllerTransition() fullscreenVC.transitioningDelegate = transition present(fullscreenVC, animated: true) › UI can be used with little code › Consider extensibility › Customization of UIView › Inheritance of UIViewController › Consider complexity within module
  5. › Device resources should be considered › Specifically: › Memory

    Issue › Decoder Full Managing Multiple Objects
  6. Player Pool › Object Pool Pattern › Provides player object

    › Manages a list of all player objects › Player Pool can › Easily handle exceptions › Limit the number of players › Reuse inactive player Player Pool workingItems awaitingItems Features < Player Owner > Player uses gets player object manages list of
  7. Summary Player Status - reflecting playback flow Player Pool -

    managing objects inside the module UI Components - providing common UI related functions