We have successfully configured Subtitles/Captions in Azure Media Player which plays media on the Web side.
But, how do we configure the same for playing the media managed by AMS in iOS for Native AVPlayer? We know that captions/subtitles can be played in native iOS player with Sidecar WebVTT file, but is the "transcript.vtt" file generated by AMS, the Sidecar WebVTT file ?
If not, how do we generate the sidecar WebVTT file?
We have implemented the code as below with Media file being accessed from AMS link and a locally downloaded transcript.vtt file, but it fails.
[EDITED : 20200413]
However, when we have local media file and local transcript.vtt file, or when we directly access the media file in the media storage account (https://mediastorageaccount.blob.core.windows.net/container/file.mp4) it works fine. But, when we access the encoded file from the link generated by AMS Transform (https://mediaservice-inct.streaming.media.azure.net/788888-6666-4444-aaaa-823422j218/file.ism/manifest(format=m3u8-cmaf)) it fails.
What is wrong here?
func playVideo()
{ let strUrl = "https://mediaservice-inct.streaming.media.azure.net/79510-6eb-340-a90-824218/German-FAST_Lesson-2-Dialog.ism/manifest(format=m3u8-cmaf)"
    localVideoAsset = AVURLAsset(url: URL(string: strUrl)!)
    //We have to add tracks in AVMutableComposition same like bellow
    //First we have to add video track on AVMutableComposition
    let videoTrack = videoPlusSubtitles.addMutableTrack(withMediaType: .video, preferredTrackID: kCMPersistentTrackID_Invalid)
    do{
        guard localVideoAsset!.tracks.count > 0 else{
            // error msg
            return
        }
        try? videoTrack?.insertTimeRange(CMTimeRangeMake(start: CMTime.zero, duration: localVideoAsset!.duration),
                                         of:localVideoAsset!.tracks(withMediaType: .video)[0],
                                         at: seconds)
    }
    //After that we have to add subtitle track in AVMutableComposition
    if isEnglishSubtitle {
        setSubtitleTrack(subtitle: "transcript")
    }else{
        setSubtitleTrack(subtitle: "transcript_tr")
    }
    //After set the video track and subtitle track we have to set in the player same like bellow
    player = AVPlayer(playerItem: AVPlayerItem(asset: videoPlusSubtitles))
    playerLayer.removeFromSuperlayer()
    playerLayer = AVPlayerLayer(player: player)
    playerLayer.frame = self.videoView.bounds
    playerLayer.videoGravity = .resizeAspect
    self.videoView.layer.addSublayer(playerLayer)
    player.play()
}
func setSubtitleTrack(subtitle : String){ print(subtitle) print(seconds)
    //Here we have to check if any pre track available. If available then we have to remove it same like bellow
    if subtitleTrack != nil{
        videoPlusSubtitles.removeTrack(subtitleTrack!)
    }
    //We have to get subtitle file from path same like bellow
    let subtitleAsset = AVURLAsset(url: Bundle.main.url(forResource: subtitle, withExtension: ".vtt")!)
    // And we have to add new track from here
    subtitleTrack = videoPlusSubtitles.addMutableTrack(withMediaType: .text, preferredTrackID: kCMPersistentTrackID_Invalid)
    do{
        guard subtitleAsset.tracks.count > 0 else{
            //error msg
            return
        }
        try? subtitleTrack?.insertTimeRange(CMTimeRangeMake(start: CMTime.zero, duration: localVideoAsset!.duration),
                                            of:subtitleAsset.tracks(withMediaType: .text)[0],
                                            at: seconds)
    }
}