use std::convert::TryFrom;
use derive_more::{Display, From, Into};
use medea_control_api_proto::grpc::api as proto;
use serde::Deserialize;
use crate::api::control::{refs::SrcUri, TryFromProtobufError};
#[derive(
Clone, Debug, Deserialize, Display, Eq, Hash, PartialEq, From, Into,
)]
pub struct WebRtcPlayId(String);
#[derive(Clone, Deserialize, Debug)]
pub struct WebRtcPlayEndpoint {
pub src: SrcUri,
#[serde(default)]
pub force_relay: bool,
}
impl TryFrom<&proto::WebRtcPlayEndpoint> for WebRtcPlayEndpoint {
type Error = TryFromProtobufError;
fn try_from(
value: &proto::WebRtcPlayEndpoint,
) -> Result<Self, Self::Error> {
Ok(Self {
src: SrcUri::try_from(value.src.clone())?,
force_relay: value.force_relay,
})
}
}