浏览代码

MediaCategoryViewController: Basic playback

Soomin Lee 7 年之前
父节点
当前提交
2a3a83b6e6
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      Sources/MediaCategories/MediaCategoryViewController.swift

+ 6 - 0
Sources/MediaCategories/MediaCategoryViewController.swift

@@ -180,6 +180,8 @@ class VLCMediaCategoryViewController<T, ModelType: MediaLibraryBaseModel>: UICol
     override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
         if let mediaObject = category.files[indexPath.row] as? NSManagedObject {
             play(mediaObject: mediaObject)
+        } else if let media = category.files[indexPath.row] as? VLCMLMedia {
+            play(media: media)
         }
     }
 
@@ -217,4 +219,8 @@ extension VLCMediaCategoryViewController {
     func play(mediaObject: NSManagedObject) {
         VLCPlaybackController.sharedInstance().playMediaLibraryObject(mediaObject)
     }
+
+    func play(media: VLCMLMedia) {
+        VLCPlaybackController.sharedInstance().play(media)
+    }
 }