Comments (1)
I haven't had any time to make this code pretty and make a PR, if anyone is able to they are welcome.
class CastMedia {
final String contentId;
String title;
String subtitle;
bool autoPlay = true;
double position;
String contentType;
String streamType;
List<String> images;
String subtitlesUrl;
CastMedia({
this.contentId,
this.title = "",
this.subtitle = "",
this.autoPlay = true,
this.position = 0.0,
this.contentType = 'video/mp4',
this.streamType = "BUFFERED",
this.images,
this.subtitlesUrl = "",
}) {
if (null == images) {
images = [];
}
}
Map toChromeCastMap() {
// If media doesn't have subtitles send without media->Tracks
if (subtitlesUrl == "")
return {
'type': 'LOAD',
'autoPlay': autoPlay,
'currentTime': position,
'activeTracks': [],
'media': {
'contentId': contentId,
'contentType': contentType,
'streamType': streamType,
'textTrackStyle': {
'edgeType': 'NONE', // can be: "NONE", "OUTLINE", "DROP_SHADOW", "RAISED", "DEPRESSED"
'fontScale': 1.0, // transforms into "font-size: " + (fontScale*100) +"%"
'fontStyle': 'NORMAL', // can be: "NORMAL", "BOLD", "BOLD_ITALIC", "ITALIC",
'fontFamily': 'Droid Sans',
'fontGenericFamily': 'SANS_SERIF', // can be: "SANS_SERIF", "MONOSPACED_SANS_SERIF", "SERIF", "MONOSPACED_SERIF", "CASUAL", "CURSIVE", "SMALL_CAPITALS",
'windowColor': '#00000', // see http://dev.w3.org/csswg/css-color/#hex-notation
'windowRoundedCornerRadius': 10, // radius in px
'windowType': 'NONE' // can be: "NONE", "NORMAL", "ROUNDED_CORNERS"
},
'metadata': {
'metadataType': 0,
'title': title,
'subtitle': subtitle,
'images': [{'url': images[0]}],
},
}
};
// If media has subtitles send subtitles tracks in media->Tracks
return {
'type': 'LOAD',
'autoPlay': autoPlay,
'currentTime': position,
'activeTracks': [],
'media': {
'contentId': contentId,
'contentType': contentType,
'streamType': streamType,
'textTrackStyle': {
'edgeType': 'NONE', // can be: "NONE", "OUTLINE", "DROP_SHADOW", "RAISED", "DEPRESSED"
'fontScale': 1.0, // transforms into "font-size: " + (fontScale*100) +"%"
'fontStyle': 'NORMAL', // can be: "NORMAL", "BOLD", "BOLD_ITALIC", "ITALIC",
'fontFamily': 'Droid Sans',
'fontGenericFamily': 'SANS_SERIF', // can be: "SANS_SERIF", "MONOSPACED_SANS_SERIF", "SERIF", "MONOSPACED_SERIF", "CASUAL", "CURSIVE", "SMALL_CAPITALS",
'windowColor': '#00000', // see http://dev.w3.org/csswg/css-color/#hex-notation
'windowRoundedCornerRadius': 10, // radius in px
'windowType': 'NONE' // can be: "NONE", "NORMAL", "ROUNDED_CORNERS"
},
'metadata': {
'metadataType': 0,
'title': title,
'subtitle': subtitle,
'images': [{'url': images[0]}],
},
'tracks': [{
'trackId': 10, // This is an unique ID, used to reference the track
'type': 'TEXT', // Default Media Receiver currently only supports TEXT
'trackContentId': subtitlesUrl, // the URL of the VTT (enabled CORS and the correct ContentType are required)
'trackContentType': 'text/vtt', // Currently only VTT is supported
'name': 'Íslenska', // a Name for humans
'language': 'is-IS', // the language
'subtype': 'SUBTITLES' // should be SUBTITLES
}]
}
};
}
}
from dart_chromecast.
Related Issues (20)
- Is it possible to change playback speed while casting? HOT 5
- "reusePort not supported" error when running example, or similar find_chromecasts() call, on Windows/Android HOT 3
- iOS 14 issue HOT 4
- Set Volume not working HOT 1
- [Solution] volume control not working
- [Solution] metadata not working (title, image, subtitle..)
- Not compatible with http: ^0.13.0 HOT 1
- Null safety HOT 2
- Fix pub analysis error HOT 2
- Mirror app screen HOT 1
- How to play DRM content with license
- Lets improve the package score HOT 3
- Adding support for sound null safety HOT 5
- how send request headers HOT 3
- Cant find any device in network HOT 1
- Web support
- Can i add playlist into chromecast queue? and play all day chromecast video with repeat mode like youtube playlist with chromecast.
- Update dependencies
- Opening web page or youtube video HOT 4
- `reusePort` not supported for Android.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dart_chromecast.