How to add/use GCKMediaQueue in Swift?
var mediaItems = [GCKMediaQueueItem]()
var urls = // Array of only audio and videos
for index in 0..<urls.count {
let builder = GCKMediaQueueItemBuilder()
let mediaInfoBuilder = GCKMediaInformationBuilder.init(contentURL: urls[i])
mediaInfoBuilder.streamType = GCKMediaStreamType.none;
mediaInfoBuilder.contentType = "video/mp4"
mediaInfoBuilder.metadata = metadata;
let mediaInformation = mediaInfoBuilder.build()
builder.mediaInformation = mediaInformation
builder.autoplay = true
builder.preloadTime = 3
let item = builder.build
mediaItems.append(item)
}
if let remoteMediaClient = GCKCastContext.sharedInstance().sessionManager.currentCastSession?.remoteMediaClient {
let loadOptions = GCKMediaQueueLoadOptions()
loadOptions.repeatMode = .all
loadOptions.startPosition = 0
remoteMediaClient.queueLoadItems(mediaItems, withOptions:loadOptions)
}
Initial chromecast setup
Try accessing http://<chromecast-ip>:9222
to see if your device is whitelisted correctly. You should see a page with a simple link in there that would open chrome debugger for your receiver.
Related Topics
Swift: Change Speed of a Moveto Skaction
Mac App Disappears When Window Is Closed Then Another App Is Selected
How to Add a Storage Reference in Swift for Firestore
Filter by Day from Nsdate in Realm, Swift
Swiftui List .Ondelete: Index Out of Range
How to Reinterpret_Cast in Swift
<= Is Not a Prefix Unary Operator
Realitykit Entity Synchronization Is Always Nil
How to Use Mtlblitcommandencoder for Copying Interlaced Video Fields into a Mtlbuffer
Programmatically Setting Texture in Scene Generated by Reality Composer
Skipnext Skipprevious Google Cast Greyed Out
Generating a Simple Algebraic Expression in Swift
Didbegincontact Not Being Called Swift
Must Call a Designated Initializer of The Superclass 'Day' Error