Use AVPlayer for multiple videos

I'm developing a tutorial style tvOS app with multiple videos. The examples I've seen so far deal with only one video.

Defining the player and source(url) before body view

let avPlayer = AVPlayer(url: URL(string: "https://domain.com/.../.../video.mp4")!))

and then in the body view the video is displayed

VideoPlayer(player: avPlayer)

This allows options such as stop/start etc.

When I try something similar with a video title passed into this view I can't define the player with this title variable.

var vTitle: String
var avPlayer = AVPlayer(url: URL(string: "https://domain.com/.../.../" + vTitle + ".mp4"")!))
    
    var body: some View {
        

I het an error that vTitle can't be used in the url above the body view.

Any thoughts or suggestions? Thanks

Use AVPlayer for multiple videos
 
 
Q