Animation while playing media with ExoPlayer - animation

so im trying to make a video player that plays media on a fraction of the screen while the remaining fraction of the screen shows different images. I am trying to tackle this using animation list:
<?xml version="1.0" encoding="utf-8"?>
<animation-list android:id="#+id/sequence"
android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/folder_icon" android:duration="200" />
<item android:drawable="#drawable/play_icon" android:duration="200" />
</animation-list>
I was able to set the layout so that I can see a single image and the exoplayer view, but im not being able to play the animation. Im not sure where (and how) should I put the command
animation.start()
and where should I declare the variable
sequenceanimation: AnimationDrawable
I´ve tried declaring the variable as a companion object and as a private lateinit var in my activity. Also I tried setting the animation.start() command in onCreate but it's not working.
When I try something along the lines, it messes up my entire code, it stops showing you the list of videos in your local storage and it jumps directly to the exoplayer/animation activity without working.

I don´t know if someone is having the same problem but I was able to solve it by placing the line animation.start() on onStart
override fun onStart() {
super.onStart()
val rocketImage = findViewById<ImageView>(R.id.animacion).apply {
setBackgroundResource(R.drawable.prueba_animacion)
secuenciaAnimation = background as AnimationDrawable
}
secuenciaAnimation.start()
}

Related

Xamarin Forms Font Icons displaying wrong symbols

In development I have no issues with FontAwesome icons used within my app, however, as soon as other devices install it in testing/production the icons appear incorrectly. I will show screenshots below.
I really appreciate anyone giving some input to this, it's quite problematic to the point where I am considering going back to images.
It seems they map incorrectly on new device installations. Sometimes I get weird Chinese characters instead. The below is just one example, this behaviour happens across the board.
Font Class
[assembly: ExportFont("fontello.ttf", Alias = "Fontello")]
namespace TestApp.Fonts
{
// cut class short for readability but it has a lot more icon codes
static class FontelloFont
{
public const string MapMarkerO = "\ue82c"; // This is the icon used in the photo of how it should look like
public const string OccupierO = "\ue832"; // This is the icon that appears in place of whats above when it shouldn't
Usage
<Label Text="{x:Static fonts:FontelloFont.MapMarkerO}"
FontSize="35"
FontFamily="Fontello"/>
What should appear
What actually appears

Trouble with vlcj to play Video

As part of a project for college, i have to be able to play video in my java app.
I've written the following code:
EmbeddedMediaPlayerComponent component = new EmbeddedMediaPlayerComponent();
JFrame f = new JFrame ();
f.setContentPane(component);
f.setBounds(new Rectangle (200,200,800,600));
f.addWindowListener(new WindowAdapter() {
public void windowClosing (WindowEvent e) {
component.release();
System.exit(0);
}
});
f.setVisible(true);
component.mediaPlayer().media().play("video");
Everything compiles successfully and when i run the project, the window for the video opens, i can hear the sound of the video but no image is shown. Can anyone help me fix this?
The EmbeddedMediaPlayerComponent needs an AWT Canvas to embed the video.
When running on macOS there is no heavyweight AWT so a normal embedded media player component will not work.
You need instead to use some form of "direct rendering" where you paint the video yourself into some lightweight component. vlcj provides an implementation of this with the CallbackMediaPlayerComponent
To get the basics working, you can simply replace your code:
EmbeddedMediaPlayerComponent component = new EmbeddedMediaPlayerComponent();
With:
CallbackMediaPlayerComponent component = new CallbackMediaPlayerComponent();
This will give you reasonable default behaviour, you can customise the CallbackMediaPlayerComponent if you need to.
The performance of this approach will not be as good as the embedded component, but for most use-cases it will be plenty good enough.

Import plist animation in Unity or extract frames

I've searched a lot on the Google but I don't find the answer that I need.
I've a lot of animation files created for IOS that come with a sprite sheet and relative plist file.
I need to import the frame of these animations in Unity but I don't know how I can do that because there isn't a direct compatibility with plist and I haven't found software that extract the correct frames from sprite sheet. Does anyone know how I can do that?
Use System.XML.XMLDocument (with TextAsset.text) to parse .plist, and TextureImporter.spritesheet with SpriteMetaData to read / write spritesheet data.
I'm using XMLDocument in production (it is fast) to read SVG files. For TextureImporter, here you can see an example where I nudge spritesheets directly with it.

Sprite Sheet Animation while moving it to another place

I am trying to make sprite sheet animation work with another Action. For this purpose i've a Sprite sheet .png file without any .plist file. My problem is that the spritesheet animation works but with other action like this one in following code block it just doesn't. It will first move it to the destination and then animates it but all i want it to move while animating itself.
void animatespritesheet()
{
for(i=0;i<10;i++)
{
_spriteFrame=CCSpriteFrame::create("bulb_f.png",CCRectMake(i*75,0,75,75));
_anims->addObject(_spriteFrame);
}
_animation=CCAnimation::createWithSpriteFrames(_anims,1.0f);
CCSprite* sprite = CCSprite::createWithSpriteFrame(_spriteFrame);
//sprite->setPosition(ccp(256,256));
CCAction* axn = CCRepeatForever::create(CCAnimate::create(_animation));
/*CCAction *axn1 = CCMoveTo::create(1.0f,CCPoint(200,200));
CCMoveTo* move = CCMoveTo::create(1.0f,CCPoint(200.0,200.0));*/
_spriteBatch->addChild(sprite);
sprite->runAction(axn);
//sprite->runAction(move);
//sprite->runAction(CCSequence::Create(move,axn,NULL);
}
_anims is a CCArray. the png file is 75*750 file which contains 10 frames.
I just can't get this thing done by myself. Please Help me out on this. I Really need help on it.
Use a CCSpawn to run both actions at the same time (this examples assumes cocos 3.0).
[CCActionSpawn actions:action1, action2, nil];

Alternatives to using a MovieClip or BitmapData for an image?

I've been trying for two days to find an alternative to loading an image into my current project. I am using Adobe Flash Professional CS6 as my IDE and Animation program. I would like to be able to display an image in my application. What I am trying to do is have the image display onto the screen, the user enters the PLU associated with the image, and if the PLU is right then they receive a point. I have everything else already to go, but I just can't find an efficient way to deal with loading the image.
Right now I'm using this to accomplish getting my image on the display:
var myDisp:Layer0 = new Layer0();
var bmp:Bitmap = new Bitmap(myDisp);
spDispBox.addChild(bmp);
The above code works just find, but the limitation I can't get around is that I'm going to have to import each image into the library and then consecutively code each part in. I wanted to stick to OOP and streamline this process, I just don't know where I should turn to in order to accomplish my project goal. I'm more than happy to give more information. Thanks in advance, everyone.
July, 26, 2014 - Update: I agree, now, that XML is the way to go. I'm just having a hard time getting the grasp of loading an external XML file. I'm following along, but still not quite getting the idea. I understand about creating a new XML data object, Loader, and URLRequest. It's just loading the picture. I've been able to get output by using trace in the function to see that the XML is loaded, but when I go to add the XML data object to the stage I'm getting a null object reference.
I'm going to try a few more things, I just wanted to update the situation. Thanks again everyone.
it seems like these images are in your FLA library. To simplify your code you can make a singleton class which you can name ImageFactory (factory design pattern) and call that when needing an image which will return a Sprite (lighter than a MovieClip)
spDispBox.addChild( ImageFactory.getImageA() ); // returns a Sprite with your image
and in your ImageFactory
public function getImageA():DisplayObject {
var image:Layer0 = new Layer0(); // image from the FLA library
var holder:Sprite = new Sprite();
holder.addChild( new Bitmap( image ) );
return holder;
}
also recommend using a more descriptive name than Layer0

Resources