I need to access videos on camera roll and also on Music+Video. but it seems there is no way at all.
Here in the documentation says we can use:
MediaLibrary library = new MediaLibrary();
But it only can access musics.
Can we say I should forget this thing for ever in WP8?
Unfortunately, there is no way to access videos in Media Library.
You have read-write access only to audio and photos.
See this answer: https://stackoverflow.com/a/13473349/1029518
There are a couple answers in the following thread which points out it is now feasible to read the video files via KnownFolders if you upgrade to Windows Phone 8.1: Windows Phone 8: Media file access
Here is an alternative option for accessing the videos (also in Windows Phone 8.1):
FileOpenPicker picker = new FileOpenPicker();
picker.ViewMode = PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
picker.FileTypeFilter.Add(".mp4");
picker.PickSingleFileAndContinue();
Once you have the file you should be able to play it back.
Related
I am trying to play an audio stream from stream server in my windows phone app. I read on Microsoft Documentation that I have to reference an Audio Stream Agent.
I have these projects in my solution :
I've tried to reference a new project as Audio Streaming Agent in my Windows Phone 8.1 application
but I keeping receiving the error :
I read that I have to change the target framework, but there is no option for target framework in the AudioStreamAgent1 properties.
Also, Can I do this using an application that is not the Silverlight kind? Is there a way to do without using the Silverlight one?
The problem is that the AudioSteamAgent is targeted at WP Silverlight, and your actual app is WP8.1 (WinRT).
To create background audio in WP8.1, you will want to use the Background Media Player.
You can find a great guide for how to get started here.
But basically (without all the boilerplate code to wire everything up), it comes down to telling the BMP what to play (code is from the link above):
BackgroundMediaPlayer.Current.SetUriSource(new Uri("ms-appx:///Assets/Media/Ring02.wma"));
BackgroundMediaPlayer.Current.Play();
And telling the OS player controls what to show, and what to do when the user interacts with them:
systemmediatransportcontrol = SystemMediaTransportControls.GetForCurrentView();
systemmediatransportcontrol.ButtonPressed += systemmediatransportcontrol_ButtonPressed;
systemmediatransportcontrol.PropertyChanged += systemmediatransportcontrol_PropertyChanged;
systemmediatransportcontrol.IsEnabled = true;
systemmediatransportcontrol.IsPauseEnabled = true;
systemmediatransportcontrol.IsPlayEnabled = true;
systemmediatransportcontrol.IsNextEnabled = true;
systemmediatransportcontrol.IsPreviousEnabled = true;
This is all assuming that you want the user to be able to leave the app and have media continue to play. If you just want to stream audio/video while the user is in the app you can use the MediaElement control.
I am looking for a touchscreen-friendly file picker for Windows 10. In Windows 8 and 8.1, i used FileOpenPicker:
FileOpenPicker fileOpenPicker = new FileOpenPicker();
fileOpenPicker.FileTypeFilter.Add(".wma");
fileOpenPicker.FileTypeFilter.Add(".mp3");
fileOpenPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
fileOpenPicker.ViewMode = PickerViewMode.List;
IReadOnlyList<StorageFile> files = await fileOpenPicker.PickMultipleFilesAsync();
which produced a nice interface (example), but in Windows 10, the same code displays the same interface as OpenFileDialog would (example), which is very hard to use on a touchscreen. Does anyone know how to get Windows 8/8.1 style FileOpenPicker in Windows 10, or knows an alternative?
In my application I have ask user to select folder (with standard folder picker that is not much touch friendly), but after this I have shown my own custom control that have display files in folder and let them select in touch friendly manner.
I want to play a song which is stored in Music+video Hub in AudioPlaybackAgent.
I can get songs by this way:
MediaLibrary mediaLibrary = new MediaLibrary();
var songs = mediaLibrary.Songs;
but this songs are of type Song and BackgroundAudioPlayer accepts sounds of type AudioTrack:
BackgroundAudioPlayer.Instance.Track = ..
Question: how can I play a song from music hub in AudioPlaybackAgent?
From here: Windows phone 8 on emulator - why can't I play audio files? see the answer number 3 (Author:Frederik Winstrup Johansen). He also added a good sample about playing AudioTracks
The BackgroundAudioPlayer can play files only from isolated storage or
from a remote URI, that is why you can here anything!
If you have your file as resources in your app, you must first copy
them to the isolated store, and then make a reference to the file in
the isolated store to your BackgroundAudioPlayer.
I am having an issue getting into the camera roll folder for Windows Phone 8. Unfortunately due to the project being a MonoGame Project, the MediaLibrary object is not implemented and thus does not work. I am left with having to directly tap into the camera roll folder directly, through I am getting an
Access Denied
Error as a result. The idea is that if I know the location of the file in the future, I can display it in certain parts of my app after the user has taken a photo using the app. The code is as follows:
StorageFile folder = await StorageFile.GetFileFromPathAsync("Pictures\\Camera Roll\\WP_20130227_001.jpg");
I have also checked off:
ID_MEDIALIB_PHOTO
and am still getting the error.
Any help is greatly appreciated!
Try using the photochoosertask..
PhotoChooserTask selectphoto = new PhotoChooserTask();
selectphoto.Completed += new EventHandler<PhotoResult>(selectphoto_Completed);
selectphoto.Show();
this might help.
am developing an application which can fetch files from internet.. how do i download and save a "docx" or "wav" file from internet within the application and use it later with other application likes office or windows media player.
You can download files in the background (ie. they will continue even when your application is not running).
Having said that, you should research the types of files you need to support. For example, you can play an audio file (if the format is supported) or add it to Music hub but you cannot open a file in Office. Very few filetypes can be integrated with, so do some research before you start writing your app otherwise you might be disappointed.
place an image control in your page. here im1 is controls name.
it is working for me
string imgurl="http://.........";(path)
Uri addrs=new Uri(imgurl,UriKind.Absolute);
BitmapImage bitmap = new BitmapImage(addrs);
im1.Source = bitmap;