su.litvak.chromecast.api.v2.Media Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-v2 Show documentation
Show all versions of api-v2 Show documentation
Java implementation of ChromeCast V2 protocol client
/*
* Copyright 2014 Vitaly Litvak ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package su.litvak.chromecast.api.v2;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static su.litvak.chromecast.api.v2.Media.MetadataType.GENERIC;
/**
* Media streamed on ChromeCast device.
*
* @see
* https://developers.google.com/cast/docs/reference/receiver/cast.receiver.media.MediaInformation
*/
public class Media {
public static final String METADATA_TYPE = "metadataType";
public static final String METADATA_ALBUM_ARTIST = "albumArtist";
public static final String METADATA_ALBUM_NAME = "albumName";
public static final String METADATA_ARTIST = "artist";
public static final String METADATA_BROADCAST_DATE = "broadcastDate";
public static final String METADATA_COMPOSER = "composer";
public static final String METADATA_CREATION_DATE = "creationDate";
public static final String METADATA_DISC_NUMBER = "discNumber";
public static final String METADATA_EPISODE_NUMBER = "episodeNumber";
public static final String METADATA_HEIGHT = "height";
public static final String METADATA_IMAGES = "images";
public static final String METADATA_LOCATION_NAME = "locationName";
public static final String METADATA_LOCATION_LATITUDE = "locationLatitude";
public static final String METADATA_LOCATION_LONGITUDE = "locationLongitude";
public static final String METADATA_RELEASE_DATE = "releaseDate";
public static final String METADATA_SEASON_NUMBER = "seasonNumber";
public static final String METADATA_SERIES_TITLE = "seriesTitle";
public static final String METADATA_STUDIO = "studio";
public static final String METADATA_SUBTITLE = "subtitle";
public static final String METADATA_TITLE = "title";
public static final String METADATA_TRACK_NUMBER = "trackNumber";
public static final String METADATA_WIDTH = "width";
/**
* Type of the data found inside {@link #metadata}. You can access the type with the key {@link #METADATA_TYPE}.
*
* You can access known metadata types using the constants in {@link Media}, such as {@link #METADATA_ALBUM_NAME}.
*
* @see
* https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_media_metadata
* @see
* https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata
*/
public enum MetadataType {
GENERIC,
MOVIE,
TV_SHOW,
MUSIC_TRACK,
PHOTO
}
/**
* Stream type.
*
* Some receivers use upper-case (like Pandora), some use lower-case (like Google Audio),
* duplicate elements to support both.
*
* @see
* https://developers.google.com/cast/docs/reference/receiver/cast.receiver.media#.StreamType
*/
public enum StreamType {
BUFFERED, buffered,
LIVE, live,
NONE, none
}
@JsonProperty
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public final Map metadata;
@JsonProperty("contentId")
public final String url;
@JsonProperty
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public final Double duration;
@JsonProperty
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public final StreamType streamType;
@JsonProperty
public final String contentType;
@JsonProperty
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public final Map customData;
@JsonIgnore
public final Map textTrackStyle;
@JsonIgnore
public final List