@@ -28,7 +28,8 @@ pod "AVPlayerViewController-Subtitles"
2828
2929| Version | Language | Minimum iOS Target |
3030| :--------------------:| :---------------------------:| :---------------------------:|
31- | 1.x | Swift | iOS 8 |
31+ | 1.0.x | Swift | iOS 8 |
32+ | 1.1.x | Swift 3.0 | iOS 8 |
3233
3334
3435### Usage
@@ -40,23 +41,23 @@ import AVPlayerViewControllerSubtitles
4041
4142``` swift
4243// Video file
43- let videoFile = NSBundle. mainBundle (). pathForResource ( " trailer_720p" , ofType : " mov" )
44+ let videoFile = Bundle. main . path ( forResource : " trailer_720p" , ofType : " mov" )
4445
4546// Subtitle file
46- let subtitleFile = NSBundle. mainBundle (). pathForResource ( " trailer_720p" , ofType : " srt" )
47- let subtitleURL = NSURL (fileURLWithPath : subtitleFile! )
47+ let subtitleFile = Bundle. main . path ( forResource : " trailer_720p" , ofType : " srt" )
48+ let subtitleURL = URL (fileURLWithPath : subtitleFile! )
4849
4950// Movie player
5051let moviePlayer = AVPlayerViewController ()
51- moviePlayer.player = AVPlayer (URL : NSURL (fileURLWithPath : videoFile! ))
52- presentViewController (moviePlayer, animated : true , completion : nil )
52+ moviePlayer.player = AVPlayer (url : URL (fileURLWithPath : videoFile! ))
53+ present (moviePlayer, animated : true , completion : nil )
5354
5455// Add subtitles
5556moviePlayer.addSubtitles ().open (file : subtitleURL)
56- moviePlayer.addSubtitles ().open (file : subtitleURL, encoding : NSUTF8StringEncoding) // optional
57+ moviePlayer.addSubtitles ().open (file : subtitleURL, encoding : String . Encoding . utf8 )
5758
58- // Change text properties (optional)
59- moviePlayer.subtitleLabel ? .textColor = UIColor.redColor ()
59+ // Change text properties
60+ moviePlayer.subtitleLabel ? .textColor = UIColor.red
6061
6162// Play
6263moviePlayer.player ? .play ()
0 commit comments