ChromeCast SDK Album Art - android

Using the default ChromeCast RemoteMediaPlayer class and the default receiver, how do you add album art to the page? I have tried looking at http://developer.android.com/reference/com/google/android/gms/cast/MediaMetadata.html, but there does not appear to be a entry for album art. There is a bug place holder on the screen though, so I assume it is supported somehow. I looked at https://github.com/googlecast/Cast-Player-Sample/blob/master/player.js, and there appears to be a case where it tries to get the art work with ar artwork = sampleplayer.getValue_(event.data, ['media', 'metadata', 'images', 0, 'url']);, but I don't see any way to actually fill that out from the client side.

MediaMetadata hold reference to images and has an addImage method. That is where you have to keep the info about your images, including album art (you can add as many references as you want, possibly different aspect ratios, resolutions, etc)

In case you cannot make it work, you could use this javascript library:
https://github.com/fenny/castjs
var device = new Castjs();
device.on('available', () => {
device.cast('https://fenny.github.io/Castjs/demo/poster.jpg', {
poster: 'https://fenny.github.io/Castjs/demo/poster.jpg',
title: 'Sintel',
description: 'Third Open Movie by Blender Foundation',
subtitles: [{
active: true,
label: 'English',
source: 'https://fenny.github.io/Castjs/demo/english.vtt'
}, {
label: 'Spanish',
source: 'https://fenny.github.io/Castjs/demo/spanish.vtt'
}],
muted: false,
paused: false
})
});
});
Notice the "poster" value, good luck.

Related

How to make Audio Trimming widget in flutter And wave graph for sound

I am new in flutter.
I want to trim a audio.
I got the audiocutter package to implement trimming.
But problem is that "How to get input from the user in better UI?".
I searched about that, but not get any proper solution.
So, how to make widget like below to get input from user?
You want to create widget like above.
Then you can add wave_slider file and use following code.
WaveSlider(
backgroundColor: Colors.grey.shade300,
heightWaveSlider: 100,
widthWaveSlider: 300,
duration: 12.0,
callbackStart: (duration) {
print("Start $duration");
},
callbackEnd: (duration) {
print("End $duration");
},
)

Multiple image uploads in React

I am building an e-commerce mobile app with react native, and I want to make it possible for the users to upload multiple images of a product, but I don't know the best package to install for this to work, I don't even know if I should do it from scratch, this question is more like an advise question just to guide me, Please any help will be really great, Thanks
I use react-native-image-cropper-picker and it cuts it. It allows multiple picking, base64, cropping among others.
To pick multiple you can do as follows:
pickMultiple() {
ImagePicker.openPicker({
multiple: true,
waitAnimationEnd: false,
includeExif: true,
forceJpg: true,
}).then(images => {
this.setState({
imagesArray: images.map(i => {
console.log('received image', i);
return {uri: i.path, width: i.width, height: i.height, mime: i.mime};
})
});
}).catch(e => alert(e));
}

React native Android VerticalDownSwipeJump bug

I use the VerticalDownSwipeJump when rendering a new scene in my React Native project. New scenes are supposed to come into view from above, pushing the current scene out of view.
On iOS this works as expected, on Android however the new scene being rendered comes into view from the above AND the right side as well.
Not sure why this is the case on android and not on iOS...
I haven't found any reports of this issue on SO or the React Native Github.
Any clues why this is happening?
This is quite old question, but maybe somebody will have the same problem. First of all, You can customize this view. The animations are defined here:
node_modules/react-native/Libraries/CustomComponents/Navigator/NavigatorSceneConfig.js
Below steps which I have made:
1.
I've created my own object:
var FromTheRightCustom = {
opacity: {
value: 1.0,
type: 'constant',
},
scaleX: {
value: 1,
type: 'constant',
},
scaleY: {
value: 1,
type: 'constant',
},
};
I've replaced FromTheRight to FromTheRightCustom in two places:
i)
var FromTheDown = {
...FromTheRightCustom,
ii)
var FromTheTop = {
...FromTheRightCustom,
The only difference, that in Android you will have empty space made by StatusBar. This can be fix e.g. by backgroundColor of navigator (sceneStyle).

Way to "preload" Canvas animation before showing the page?

I have started experimenting with the WebView in order to display locally stored HTML files that play some fairly basic Canvas animations (using the CreateJS library).
They seem to play really well but some times, the page is loading and playing the animation before images are fully loaded (e.g. one animation has a fairly large background image ~1mb)
Is there a way to either "speed" things up, "preload/prefetch" the images (and other assets if need be) or simply wait till the app has loaded the images into its memory (if it does that) before displaying and starting the animation?
To add to that last question, is there a way to "pause" the animation and only play it once the images have fully loaded?
Thanks
Try with onload event which runs after all images or external resources are loaded:
$(window).load(function(){
//code
});
or you can try with load event for individual images and run your code when they have loaded:
$('img.imgClass').load(function(){
// The image loaded,,, code
});
The CreateJS suite includes PreloadJS, which is a pretty decent way of preloading content that is used by EaselJS, or any other content for that matter.
http://preloadjs.com
You can pre-fetch images, javascript, audio, JSON/text/XML, SVG, CSS, etc.
var queue = new createjs.PreloadJS();
queue.addEventListener("complete", handleComplete);
queue.loadManifest([
{id: "image", src:"image.png"},
{id: "image2", src: "image2.jpg"},
{id:"script", src:"script.js"}
]);
function handleComplete(event) {
var image = queue.getResult("image"); // Returns an image tag
}
There are some workarounds to preload audio (with multiple formats), or use tag loading to get around cross-domain issues. Check out the docs for more:
http://www.createjs.com/Docs/PreloadJS/modules/PreloadJS.html
You can do it like this:
create a function that should do this:
loadData();
loadData = function()
{
preloader = new createjs.LoadQueue(true);
preloader.addEventListener("complete",this.handleComplete.bind(this));
var manifest = [
{src:"./images/yourIMAGE.PNG"},
];
preloader.loadManifest(manifest);
};
handleComplete = function()
{
console.log("Load complete!");
//other function
};
}
This is a way to do it. If you have questions just let me know.

titanium - android tab icons for density specific resources not working

So following the concept here:
http://docs.appcelerator.com/titanium/2.1/index.html#!/guide/Using_density-specific_resources_on_Android
i created a folder that was
Resources/android/images/
and then under that is:
high/
medium/
low/
and within each of those are the different-density files (like about.png, say)
The problem is that when i reference them:
var aboutTab = Ti.UI.createTab({
icon: '/images/about.png',
title: 'about',
window: about
});
OR as others have suggested like so (that is, losing the leading slash on 'images'):
var aboutTab = Ti.UI.createTab({
icon: 'images/about.png',
title: 'about',
window: about
});
and then load up the app, sure the tabs themselves are there... but the icons are not. Note that if i have a plain old file present at:
Resources/images/about.png
then the icon will appear... but not otherwise. Is there... is there something i'm missing on this?
Plz read and understand with cool mind this is working with me "More control" Paragraph.
var aboutTab = Ti.UI.createTab({
icon: 'images/about.png', // "/" remove this and try again
title: 'about',
window: about
});
plz, remove you old application from your Device or Emulator. after this Clean then build i think then this is work properly.
Ok, so the standard answer never ended up working for me. I'm using Titanium 2.1 here. {insert insult about Ti developer heritage here}
The solution to this is simple - don't use the much vaunted "smart titanium density specific solution" as discussed here:
http://docs.appcelerator.com/titanium/2.1/index.html#!/guide/Using_density-specific_resources_on_Android
Instead, use this simple, homely code to fix your problems!
var density = (Titanium.Platform.displayCaps.dpi <= 160) ? 'low' : (Titanium.Platform.displayCaps.dpi > 160 && Titanium.Platform.displayCaps.dpi < 240) ? 'medium' : 'high';
var preamble = (Ti.Platform.osname === 'iphone' || (Ti.Platform.osname === 'ipad') )? 'images':'android/images/'+density + '/';
Ok, so the first bit sets the density - NOTE i do not know the proper density readings for Ti just now, i'm just putting this up until i work them out anyhoo - and the second bit uses it if the app is an android one.
Then, where i used to have:
var aboutTab = Ti.UI.createTab({
icon: 'images/about.png',
title: 'about',
window: about
});
i now have:
var aboutTab = Ti.UI.createTab({
icon: preamble + '/about.png',
title: 'about',
window: about
});
And that is that!
FINAL WORD:
i've noticed that this can behave very differently depending on the Titanium version used (2.1.3 vs 2.1.0) or the android sdk used. I've had best results with 2.1.0 and 4.2 android, and that includes using the 'images' prefix (you know, how the guides say to do it).
One thing i noticed was that I cannot have both the high/medium/low folders AND the hdpi folders, i need one or the other.
Another problem i faced was that sometimes the code wouldn't load the android/images/ folders across. The completely bullet-proof way to do this is to use the code i've described, but put the density-specific folders directly under your images folder, and refer to them via images/high/ etc. Content in images is always copied across, and the code shown always works, regardless of Ti version.
Final note, make sure that your images are case-sensitively named, because it will work in the windows emulator but not in actual (unix-based) device.

Categories

Resources