How can I get MP3 flux with Windows Phone 7? - windows-phone-7

I tried this code, but it didn't work:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<MediaElement Height="120"
HorizontalAlignment="Left"
Margin="-12,148,0,0"
Name="mediaPlayer"
VerticalAlignment="Top"
Width="474"
AutoPlay="True"
/>
</Grid>
C#:
Uri Path = new Uri("http://streaming.acc.net:8000/kalilo");
mediaPlayer.Source = Path;

Looks like you're using a unsupported type of stream. And since your link isn't valid, that's all the info we can provide.
Remember that you can't play music in the emulator, and on the device you need to use WPConnect.exe to connect instead of Zune, to make it actually play.

If that is a streaming service, MediaElement is a basic, but often unreliable source because of possible interruptions (e.g. switching from WiFi to a cell data connection). It works in most situations, but it has restrictions on media content that is passed through it.
Assuming that the URI you are showing belongs to a Shoutcast stream, it is not supported by default and you need to implement a connector through MediaStreamSource, even if you receive MP3 bytes.
Here is a great MediaStreamSource example from Tim Heuer.
Also worth checking out - ManagedMediaHelpers.

Related

Lottie error:"Java.Lang.IllegalStateException: 'Unable to parse composition'"

When i tried to load gif to my project suddenly return me error:
Java.Lang.IllegalStateException: 'Unable to parse composition'
Image for more information link
I want to insert gif to my project I tried to use Lottie and Json File
My code so far
<forms:AnimationView
x:Name="animationView"
Grid.Row="1"
Animation="first.json"
Loop="false"
AutoPlay="false"/>
Please add xmlns:lottie="clr-namespace:Lottie.Forms;assembly=Lottie.Forms" to your XAML head and use this component
<lottie:AnimationView
x:Name="AnimationView"
Animation="first.json"
AutoPlay="True" Loop="true"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand" />
and dont forget to init AnimationViewRenderer.Init(); on MainActivity and AppDelegate
In my case i replaced app:lottie_url with app:lottie_rawRes , and it worked just fine
need determine json like
Android: DroidProject/Assets/filename.json like AndroidAsset
iOS: iOSProject/filename.json like BundleResource
This error occurred when lottie.setAnimation(""); is not set or blank

App displays URL images from other URLs than my own

I am unable to make the URL public, but I've pasted the full URL into my browser and can confirm the page is right - the image shows in the browser.
But... when I copy that exact URL into a Xamarin.Forms image, set as:
<Image
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Aspect="AspectFit">
<Image.Source>
<UriImageSource Uri="https://example.com/images/doesntshow.jpg"
CacheValidity="3"
CachingEnabled="false"/>
</Image.Source>
</Image>
The image simply will not show.
If I substitute the URL: "https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg" the image shows fine.
NOTE: There is 0 possibility the URL is incorrect or has an error because... I'm not typing it; I'm copying/pasting it and it's showing just fine in the browser, just not the Xamarin.Forms app.
I've not a clue as to what to look for. Does anyone else?
ISSUE RESOLVED - thanks for the good mental vibes :)
I found the resolution here:
https://forums.xamarin.com/discussion/105036/images-from-url-not-showing-on-android
April 5
"Just change the following options and it should work with https too.
Android Options => Advanced
HttpClient implementation = Set to "Managed" option value
SSL/TLS implementation = set to "Native TLS 1.2+" option value"
I still don't understand why prior to this setting change, I could load https images from other servers just fine (e.g. "https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg"). So... I will lose a bit of sleep wondering what is different on my server from wiki's. If you have a clue, please share.

Data binding the Image control in Windows 8 to a URL?

In Windows 8/Store programming, how would you go about databinding an image to a URL. In other platforms I've worked with, I would set the source property (or equivalent) to the URL and the platform would handle it for me, but that doesn't seem to be the case here.
I'm currently binding it to a property for my business object that is of type "string", and returns the URL of the image that I want populated in the image control. How would I go about doing this?
Turns out this is really easy.
Code:
<Image Stretch="UniformToFill">
<Image.Source>
<BitmapImage UriSource="{Binding Path=ImageUrl}" />
</Image.Source>
</Image>
ImageUrl is a Uri containing the path to the remote image.

x:Type in Windows Phone App

In a WPF Application I can use x:Type, e.g. for ConverterParameter:
<TextBlock Text="{Binding SelectedParty.Firstname}" Visibility="{Binding SelectedParty,Converter={StaticResource TypeToVisibilityConverter}, ConverterParameter={x:Type model:PersonParty}}"/>
In a Windows Phone 8 App "x:Type" is unavailable! How can I pass a type?
Thanks!
You could just pass the object as the parameter and then determine it's type in the converter.
This would therefore mean you're creating a "PartyToVisibility" converter but just basing the logic on the type of the party.

whindow phone IE-7 java script prb

I have made a webpage. The IE 7 of windows 7 doesn't execute Javascript. How do I enable Javascript on the Windows Phone?
Windows Phone 7 runs a mobile version of IE9 so there should be no problems executing javascript. The only thing I can think of with the little information is that you are trying to use a webbrowsercontrol from within an application. In that case you should set the IsScriptEnabled property to true to enable scripts within the control.
chirag !
In window phone 7, you can enable Javascript.
in xaml , you can set isScriptEnabled= true.
Examle:
<phone:WebBrowser HorizontalAlignment="Left" Width="480" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Visible" Name="webBrowser" Height="80" VerticalAlignment="Bottom" IsScriptEnabled="True" ScriptNotify="webBrowser_ScriptNotify" Navigated="webBrowser_Navigated" Navigating="webBrowser_Navigating" />
you can use event :
private void webBrowser_ScriptNotify(object sender, Microsoft.Phone.Controls.NotifyEventArgs e)
{
//your code : e is returned from the javascript code if javaScript is active
}
You can down load HTML content by use : webClient or string htmlcontent = webBrowser.SaveToString
Hope this help ! Thongaduka

Resources