All right, we're looking at RecordSoundsViewController right now.
And what I've done here,
is that I've embedded the code that we saw in the previous video in this file.
Let me walk you through it.
First I imported AVFoundation, and
then I declared an object of AVAudioRecorder, globally.
Then I added all of the code from the previous video,
to the record audio function.
This includes a print statement, which will print the name and
the part of the file where we have recorded our voice.
Now while I'm at it, let me add code to the Stop Audio function also.
Here I will stop the audioRecorder, and then deactivate the audio session.
I encourage you to Google and
figure out why we need to add these two lines to our code.
By the way, all of this code that we have added in this file,
is available in the instructor notes for you to play with.
All right. I'm going to run my project.
So now when I hit the Record button,
I get a print statement here in the debug area of my x code.
This seems like the file name with the current date stamp that has been printed.
Today is November 4th, 2014, and it's just past 12 p.m where I am.
So it seems like the file name is correct.
Okay, let me try this one more time and see if the time stamp actually changes.
There.
And it seems like it does.
The time stamp now is looking at 12 p.m, 2 minutes and 36 seconds.
One last thing to notice here,
is that even though we've been able to successfully print the name of the file,
we still don't know if our audio is being recorded successfully.
Let's find out more about that in the next video.
.حسنًا، نلقي نظرةً على RecordSoundsViewController الآن
،وما قمت بفعله هنا
.هو أنني قمت بتضمين التعليمة البرمجية التي رأيناها في الفيديو السابق في هذا الملف
.اسمحوا لي أن أعرضها لكم
في البداية، لقد قمت باستيراد AVFoundation، ثم
.أظهرت كائن AVAudioRecorder، بشكلٍ عام
،ثم أضفت التعليمة البرمجية كلها من الفيديو السابق
.إلى دالة صوت التسجيل
يشمل ذلك عبارة print التي ستتطبع الاسم
.والجزء الخاص بالملف الذي سجلنا فيه الصوت الخاص بنا
.والآن، عندما أصل إليها، دعوني أضيف التعليمة البرمجية إلى دالة Stop Audio أيضًا
.وسأقوم بإيقاف audioRecorder هنا، ثم تعطيل جلسة الصوت
أنصحكم بالبحث في Google
.واكتشاف سبب احتياجنا لإضافة هذين السطرين إلى التعليمة البرمجية الخاصة بنا
،بالمناسبة، تتوفر لكم التعليمة البرمجية كلها التي قمنا بإضافتها في هذا الملف
.في ملاحظات المدرب للتشغيل باستخدامها
.حسنًا. سأقوم بتشغيل مشروعي
،لذا، فعندما أضغط على الزر Record
.أحصل على عبارة print هنا قي منطقة تصحيح الأخطاء في تعليمة x البرمجية الخاصة بي
.يبدو ذلك مثل اسم الملف بطابع التاريخ الحالي الذي تمت طباعته
.اليوم هو الرابع من نوفمبر، عام 2014، وتخطت الساعة 12 مساءً في المكان الذي أوجد به
.لذا، فيبدو أن اسم الملف صحيحًا
.حسنًا، اسمحوا لي تجربة ذلك مرة أخرى ومعرفة إذا كان طابع الوقت يتغير فعليًا
.هناك
.يبدو أن ذلك يحدث
.يشير طابع الوقت الآن إلى 12 مساءً، ودقيقتين، و36 ثانية
،وهناك أمر أخير أشير إليه هنا
،ألا وهو على الرغم من قدرتنا على طباعة اسم الملف بنجاح
.مازلنا لا نعرف إذا كان يتم توصيل الصوت الخاص بنا بنجاح
.دعونا نكتشف المزيد عن ذلك في الفيديو القادم
Certo, estamos vendo o RecordSoundsViewController agora.
E o que eu fiz aqui
foi incorporar o código que vimos no vídeo anterior neste arquivo.
Deixe-me mostrar como fazer isso.
Primeiro, importei AVFoundation e
declarei um objeto de AVAudioRecorder globalmente.
Depois, adicionei todo o código do vídeo anterior
à função recordAudio.
Incluindo uma instrução print, que imprimirá o nome e
o caminho do arquivo onde gravamos nossa voz.
Agora, enquanto estou aqui, deixe-me adicionar código à função stopAudio também.
Aqui vou parar o audioRecorder e desativar a audioSession.
Gostaria que você olhasse no Google e
tentasse descobrir por que precisamos adicionar estas duas linhas ao nosso código.
Aliás, todo esse código que acrescentamos neste arquivo
está disponível nas Notas do instrutor para você testar.
Tudo bem. Vou executar meu projeto.
Quando pressiono o botão de gravação,
aparece uma instrução print aqui na área de depuração do meu Xcode.
Parece ser o nome do arquivo com o carimbo de data atual que foi impresso.
Hoje é dia 4 de novembro de 2014 e é um pouco depois do meio-dia onde estou.
Então, parece que o nome do arquivo está correto.
Ok, deixe-me fazer isso mais uma vez e ver se o carimbo de data e hora realmente muda.
Pronto.
Parece que muda.
O carimbo de data e hora agora mostra 12 horas, 2 minutos e 36 segundos.
Uma última coisa relevante aqui
é que mesmo que tenhamos sido capazes de imprimir com êxito o nome do arquivo,
ainda não sabemos se o nosso áudio está sendo gravado com sucesso.
Vamos descobrir no próximo vídeo.