Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/detached/jdial
A DIAL client implementation in plain java
https://github.com/detached/jdial
netflix smartphone smarttv ssdp upnp youtube
Last synced: 4 months ago
JSON representation
A DIAL client implementation in plain java
- Host: GitHub
- URL: https://github.com/detached/jdial
- Owner: detached
- License: gpl-3.0
- Created: 2018-01-06T00:15:27.000Z (about 7 years ago)
- Default Branch: develop
- Last Pushed: 2023-12-18T14:04:21.000Z (about 1 year ago)
- Last Synced: 2024-09-28T19:02:13.206Z (4 months ago)
- Topics: netflix, smartphone, smarttv, ssdp, upnp, youtube
- Language: Java
- Homepage: https://detached.github.io/jdial/
- Size: 97.7 KB
- Stars: 2
- Watchers: 3
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# JDial
JDial is an plain java implementation of the Discovery and Launch (DIAL) protocol version 2.1 defined by Netflix and YouTube.
DIAL allows second screen devices (smartphone, laptop, ...) to discover server instances in the local network and
launch applications on a first screen device (smart TV).For additional information about the protocol see [Wikipedia](https://en.wikipedia.org/wiki/Discovery_and_Launch)
and [dial-multiscreen.org](http://www.dial-multiscreen.org).A list of reserved application names can also be found on the [dial-multiscreen.org](http://www.dial-multiscreen.org/dial-registry/namespace-database) site.
JDial has no dependencies to any library and can therefore be integrated in every program and app.
# Dependency declaration
You can find the latest release in the [sonatype repository](https://central.sonatype.com/artifact/de.w3is/jdial).
## Maven
```
de.w3is
jdial
1.6```
## Gradle```
implementation 'de.w3is:jdial:1.6'
```# Usage
## Discover
```
List devices = new Discovery().discover();
```## Creat a DialClientConnection
```
DialServer dialServer = devices.get(0);
DialClient dialClient = new DialClient();DialClientConnection tv = dialClient.connectTo(dialServer);
```## Discover applications
```
Application youtube = tv.getApplication(Application.YOUTUBE);
```## Start applications
```
tv.startApplication(youtube);
```## Stop applications
```
tv.stopApplication(youtube);
```## Implement application vendor protocol
```DialContent content = new DialContent() {
@Override
public String getContentType() {
return "application/json; encoding=UTF-8";
}@Override
public byte[] getData() {
return "{}".getBytes(Charset.forName("UTF-8"));
}
};myTv.startApplication(youtube, content)
```## Legacy support
Some server implementations are not compatible with current versions of the DIAL protocol.
For example some LG TVs support DIAL, but the server implementation can't handle query parameters.
By creating a ProtocolFactoryImpl and setting the `legacyCompatibility` flag the client doesn't set any query parameter.```
bool supportLegacyDevices = true;
ProtocolFactory factory = new ProtocolFactoryImpl(supportLegacyDevices);
DialClient dialClient = new DialClient(factory);
```## Logging
Logging is done via java util logging.