This is a UPnP client library for Rust.

feat: Add support for SetNextAVTransportURI, Next, Previous

Changed files
+46
src
+46
src/media_renderer.rs
··· 98 98 Ok(()) 99 99 } 100 100 101 + pub async fn next(&self) -> Result<(), Error> { 102 + let mut params = HashMap::new(); 103 + params.insert("InstanceID".to_string(), "0".to_string()); 104 + self.device_client 105 + .call_action("AVTransport", "Next", params) 106 + .await?; 107 + Ok(()) 108 + } 109 + 110 + pub async fn previous(&self) -> Result<(), Error> { 111 + let mut params = HashMap::new(); 112 + params.insert("InstanceID".to_string(), "0".to_string()); 113 + self.device_client 114 + .call_action("AVTransport", "Previous", params) 115 + .await?; 116 + Ok(()) 117 + } 118 + 119 + pub async fn set_next(&self, url: &str, options: LoadOptions) -> Result<(), Error> { 120 + let dlna_features = options.dlna_features.unwrap_or("*".to_string()); 121 + let content_type = options.content_type.unwrap_or("video/mpeg".to_string()); 122 + let protocol_info = format!("http-get:*:{}:{}", content_type, dlna_features); 123 + let title = options 124 + .metadata 125 + .clone() 126 + .unwrap_or(Metadata::default()) 127 + .title; 128 + let artist = options.metadata.unwrap_or(Metadata::default()).artist; 129 + 130 + let m = Metadata { 131 + url: url.to_string(), 132 + title, 133 + artist, 134 + protocol_info, 135 + }; 136 + 137 + let mut params = HashMap::new(); 138 + params.insert("InstanceID".to_string(), "0".to_string()); 139 + params.insert("NextURI".to_string(), url.to_string()); 140 + params.insert("NextURIMetaData".to_string(), build_metadata(m)); 141 + self.device_client 142 + .call_action("AVTransport", "SetNextAVTransportURI", params) 143 + .await?; 144 + Ok(()) 145 + } 146 + 101 147 pub async fn get_volume(&self) -> Result<u8, Error> { 102 148 let mut params = HashMap::new(); 103 149 params.insert("InstanceID".to_string(), "0".to_string());