Windows Phone Music Sample Code - windows-phone

I downloaded this
http://code.msdn.microsoft.com/wpapps/Music-Videos-Hub-Sample-8ef80aab
deploys without error but I hear no sound.
Any ideas?

Try This, it's the simplest way to play a media file on WP 7/8 :
MediaPlayerLauncher objMediaPlayerLauncher = new MediaPlayerLauncher();
objMediaPlayerLauncher.Media = new Uri("SongName.mp3", UriKind.Relative);
objMediaPlayerLauncher.Location = MediaLocationType.Install;
objMediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop | MediaPlaybackControls.All;
objMediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
objMediaPlayerLauncher.Show();

Related

getting FindFailed issue in sikuli for image on windows server 2019 (ADO VM)

Getting below error when running script on window server 2019 (ADO VM) through pipeline , same script is working fine on windows 10 (having resolution 1920X1080).
I am using screen resolution utility to change the VM resolution to 1920X1080 in pipeline.
I am setup the path Bundle Folder by using below text:
ImagePath.setBundleFolder(new File(System.getProperty("user.dir")+"/SikuliImages"));
using below code
ImagePath.setBundleFolder(new File(System.getProperty("user.dir")+"/SikuliImages"));
System.out.println("Image Bundle Path="+ImagePath.getBundlePath());
Screen screen=new Screen();
String UserName_Image_Path = System.getProperty("user.dir")+"/SikuliImages/UserName_TextBox.png";
String UserPassword_Image_Path = System.getProperty("user.dir")+"/SikuliImages/UserPassword_TextBox.png";
String SignIn_Image_Path = System.getProperty("user.dir")+"/SikuliImages/SignIn_Button.png";
Pattern P_UserName = new Pattern(UserName_Image_Path);
Pattern P_UserPassword = new Pattern(UserPassword_Image_Path);
Pattern P_SignIn = new Pattern(SignIn_Image_Path);
System.out.println("Wait for popup");
screen.wait(P_UserName,30);
Match UserName_Found = screen.exists(UserName_Image_Path);
UserName_Found.highlight(2);
screen.type(P_UserName,UserName);
Match UserPassword_Found = screen.exists(UserPassword_Image_Path);
UserPassword_Found.highlight(2);
screen.type(P_UserPassword,UserPassword);
Match SignIn_Found = screen.exists(SignIn_Image_Path);
SignIn_Found.highlight(2);
screen.click(P_SignIn);
FindFailed : C:\agent\vsts-agent-win-x64-2.200.2_work\1\s\Automation/SikuliImages/UserName_TextBox.png: (378x54) in R[0,0 1920x1080]#S(0)
Line 2226, in file Region.java
Could someone help me please.
This is not valid windows path since it contains both \ and /

how to record microphone and piano at same time

I am trying to make a app which can record the piano sound make by AudioKit AKOscillatorBank and vocal from microphone at same time in swift 4. I tried AVFoundation's AVAudioRecorder, but it failed when I playing piano. I have tried using AVAudioSessionCategoryPlayAndRecord but it still seems not work:
func startRecording() {
fileName = String(format:"AudioFile%d.m4a",k)
k = k+1
let audioFilename = getDocumentsDirectory().appendingPathComponent(fileName)
address.append("\(audioFilename)")
print("adress = %s",address[num])
num = num + 1
let settings = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 12000,
AVNumberOfChannelsKey: 2,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
]
do {
try session.setCategory(AVAudioSessionCategoryPlayAndRecord, with:AVAudioSessionCategoryOptions.defaultToSpeaker)
try session.setActive(true)
SoundRecorder = try AVAudioRecorder(url: audioFilename, settings: settings)
SoundRecorder.isMeteringEnabled = true
SoundRecorder.prepareToRecord()
SoundRecorder.delegate = self
SoundRecorder.record()
} catch {
}
}
I have no Idea what can I do, is there any way to do it by swift or objective C? any advice and suggestions will be greatly appreciated.
To record different AudioKit nodes, use AKNodeRecorder. There is a "Recorder" example project included with AudioKit:
https://github.com/AudioKit/AudioKit/blob/v4-master/Examples/iOS/Recorder/Recorder/ViewController.swift

How to access file info programmatically on Mac?

Setup:
I have a bunch of audio files on my new Mac (Yosemite). When I right click on any file and do "Get Info", it gives me nice detailed info about that song under "More Info" tag, e.g.
Objective:
I need to write a program where I can list, something like this for all songs in a directory:
Album, Title, Year Recorded
.
.
.
Problem:
I have no idea how to do this. I am totally new to Mac and Objective-C/Swift (Objective-C or Swift is what I will have to use to write this program I guess??)
Is there an API where I can access this file info programmatically? And is there any other language which I can use to write this sort of program? Something which I already know, like Java, Python, etc.?
I don't have any code as of now to show 'What I have tried so far', since I am still searching for the starting point. Any pointers would be much appreciated.
As you've noticed, the mdls command can provide this metadata. You should not try to parse that. Instead, you can use the same APIs that it is built on.
You need to obtain an NSURL for a file of interest. Then, you can obtain a dictionary of its metadata attributes like so:
MDItemRef item = MDItemCreateWithURL(NULL, (__bridge CFURLRef)url);
NSArray* names = #[ (__bridge NSString*)kMDItemAlbum, /* ... */ ];
NSDictionary* dictionary = CFBridgingRelease(MDItemCopyAttributes(item, (__bridge CFArrayRef)names));
CFRelease(item);
Now, dictionary contains the desired attributes.
So, I have found one way to do this.
Mac does provide a utility called mdls, which lists file metadata. So if I do the mdls on my about example file, I get this:
myuser00m:Hindi myuser$ mdls Pani\ Da\ Rang.mp3
kMDItemAlbum = "Vicky Donor"
kMDItemAlternateNames = (
"/Users/myuser/Documents/My Stuff/Music/Hindi/Pani Da Rang.mp3"
)
kMDItemAudioBitRate = 165000
kMDItemAudioChannelCount = 2
kMDItemAudioEncodingApplication = "Eac * Lame"
kMDItemAudioSampleRate = 44100
kMDItemAuthors = (
"Ayushmann Khurrana"
)
kMDItemComposer = "Music: Abhishek - Akshay"
kMDItemContentCreationDate = 2015-06-16 04:42:30 +0000
kMDItemContentModificationDate = 2015-06-16 04:42:30 +0000
kMDItemContentType = "public.mp3"
kMDItemContentTypeTree = (
"public.mp3",
"public.audio",
"public.audiovisual-content",
"public.data",
"public.item",
"public.content"
)
kMDItemCopyright = "www.Songs.PK"
kMDItemDateAdded = 2015-07-26 19:52:49 +0000
kMDItemDisplayName = "Pani Da Rang"
kMDItemDurationSeconds = 240.8489795918368
kMDItemFSContentChangeDate = 2015-06-16 04:42:30 +0000
kMDItemFSCreationDate = 2015-06-16 04:42:30 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = (null)
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = (null)
kMDItemFSLabel = 0
kMDItemFSName = "Pani Da Rang.mp3"
kMDItemFSNodeCount = (null)
kMDItemFSOwnerGroupID = 784317889
kMDItemFSOwnerUserID = 376797083
kMDItemFSSize = 5826388
kMDItemFSTypeCode = ""
kMDItemKind = "MP3 audio"
kMDItemLogicalSize = 5826388
kMDItemLyricist = "www.Songs.PK"
kMDItemMediaTypes = (
Sound
)
kMDItemMusicalGenre = "Bollywood"
kMDItemPhysicalSize = 5828608
kMDItemRecordingYear = 2012
kMDItemTitle = "Pani Da Rang"
kMDItemTotalBitRate = 165000
myuser00m:Hindi myuser$
Now I need to write some code to parse this and extract fields of interest.
Obviously, it is not that cool solution, but until I find something better, this will do. I will update my answer once I find something better.

FFMpeg Out of sync audio/video in iOS application

The app saves the camera output into a mov. file, then turn it to flv format that sent by AVPacket to rtmp server.
It switch every time between two files, one is written by the camera output and the other one is sent.
My problem is that the audio/video is getting out of sync after a while.
The first buffer sent is allways 100% sync but after awhile it get messed.
I belive its a DTS-PTS problem..
if(isVideo)
{
packet->stream_index = VIDEO_STREAM;
packet->dts = packet->pts = videoPosition;
videoPosition += packet->duration = FLV_TIMEBASE * packet->duration * videoCodec->ticks_per_frame * videoCodec->time_base.num / videoCodec->time_base.den;
}
else
{
packet->stream_index = AUDIO_STREAM;
packet->dts = packet->pts = audioPosition;
audioPosition += packet->duration = FLV_TIMEBASE * packet->duration / audioRate;
//NSLog(#"audio position = %lld", audioPosition);
}
packet->pos = -1;
packet->convergence_duration = AV_NOPTS_VALUE;
// This sometimes fails without being a critical error, so no exception is raised
if((code = av_interleaved_write_frame(file, packet)))
{
NSLog(#"Streamer::Couldn't write frame");
}
av_free_packet(packet);
You can research this sample: http://unick-soft.ru/art/files/ffmpegEncoder-vs2008.zip
But this sample is for Windows.
In this sample I use pts only for audio stream:
if (pVideoCodec->coded_frame->pts != AV_NOPTS_VALUE)
{
pkt.pts = av_rescale_q(pVideoCodec->coded_frame->pts,
pVideoCodec->time_base, pVideoStream->time_base);
}
I was experiencing a similar issue when switching out the AVAssetWriters, and noticed that it went way if I only started using the new AVAssetWriter when I got a video sample
https://medium.com/#brandon.kobel/ios-seamless-video-chunks-4383a5a3a874

CreateFile2 error in WinRT project (ERROR_NOT_SUPPORTED_IN_APPCONTAINER)

I just working on some file management api in WinRT. I successfully created folder in ../Packages/myApp/LocalState/ but when I try to create new file (CreateFile2) in that folder I get this
error 4252: ERROR_NOT_SUPPORTED_IN_APPCONTAINER
This functionality is not supported in the context of an app container.
code:
localFolder = L"C:\\Users\\Tomas\\AppData\\Local\\Packages\\myApp\\LocalState\\my";
CreateDirectory(localFolder.c_str(),NULL);
localFolder += L"\\MyFile.txt";
CREATEFILE2_EXTENDED_PARAMETERS pCreateExParams;
pCreateExParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
pCreateExParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
pCreateExParams.lpSecurityAttributes = NULL;
pCreateExParams.hTemplateFile = NULL;
HANDLE myfile = CreateFile2(localFolder.c_str(), GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, OPEN_ALWAYS, &pCreateExParams);
int error = GetLastError();
What I'm doing wrong? Should I set some options in manifest?
Thank you for your help
Already found the problem - in pCreateExParams struct was some undefined values in .dwFileFlags and .dwSecurityQosFlags. So this works fine:
CREATEFILE2_EXTENDED_PARAMETERS pCreateExParams = {0};