تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
كيف اشغل ملف mp3 من resources بدون أن استخرج ملف mp3
#1
كيف اشغل ملف mp3 من resources بدون أن استخرج ملف mp3 من الـresources ؟
الرد }}}
تم الشكر بواسطة:
#2
وجدت :
Approach #1. If you really need a way to stream a video from the resource, you need to create a resource stream using the resource you need. This will give you an idea: http://social.msdn.microsoft.com/Forums/...5c93c8cfc2[^], http://msdn.microsoft.com/en-us/library/...eader.aspx[^].

Feeding the stream read from resource as the input of your Media Player control is difficult. The only input is URI. I could not find that a special Microsoft URL schema "res://" supported. As a general approach, you need to develop a special URI instead. You will need to use the constructor for the System.Uri: Uri(SerializationInfo, StreamingContext). For more information, see http://msdn.microsoft.com/en-us/library/system.uri.aspx[^].

This approach will take some effort.

هل يمكن استفيد من هذا؟ فأنا لم أفهم منه
الرد }}}
تم الشكر بواسطة:
#3
وهل يمكن أن استفيد من هذا أيضاً:
Playing from a resource
Instead of creating a temporary file for playing a sound from a resource its both faster and doesn't create any unnecessary temp files if you create a byte array and fill it with the sounds byte, then allocate a pointer to that byte array and pass it to the sndPlaySound method with the SND_MEMORY flag.

This is some code i hacked up to play from a memory stream. this is assuming there is a byte array called Sbuffer and a bool called _buffer that tells the play method if the sound file is buffered.


[DllImport("winmm.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
static extern bool PlaySound(string pszSound,
IntPtr hMod, SoundFlags sf);

[DllImport("winmm.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
static extern bool sndPlaySound(IntPtr ptr, int fuSound);


[Flags]
public enum SoundFlags : int
{
SND_SYNC = 0x0000, /* play synchronously (default) */
SND_ASYNC = 0x0001, /* play asynchronously */
SND_NODEFAULT = 0x0002, /* silence (!default) if sound not found */
SND_MEMORY = 0x0004, /* pszSound points to a memory file */
SND_LOOP = 0x0008, /* loop the sound until next sndPlaySound */
SND_NOSTOP = 0x0010, /* don't stop any currently playing sound */
SND_NOWAIT = 0x00002000, /* don't wait if the driver is busy */
SND_ALIAS = 0x00010000, /* name is a registry alias */
SND_ALIAS_ID = 0x00110000, /* alias is a predefined ID */
SND_FILENAME = 0x00020000, /* name is file name */
SND_RESOURCE = 0x00040004 /* name is resource name or atom */
}

public void Play()
{
if (_buffer)
{
GCHandle h = GCHandle.Alloc(Sbuffer);
IntPtr SoundPoint = Marshal.UnsafeAddrOfPinnedArrayElement(Sbuffer, 0);
sndPlaySound(SoundPoint, (int)SoundFlags.SND_MEMORY | (int)SoundFlags.SND_ASYNC);
h.Free();
}
else
{
PlaySound(path, new System.IntPtr(), SoundFlags.SND_SYNC);
}
}

وهو بلغة C# وليس VB.NET ولم استطع أن أفهم منه جيداً
أنا قمت بتخزين الصوت في شكل Byte () هل هذا هو المقصود؟ وكيف اشغله , ملاحظة أنني خزنت الصوت في متغير باسم bb على شكل Byte ()
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  فلترة datagridview بدون قاعدة بيانات صالح عبدالله 3 295 02-02-24, 04:07 PM
آخر رد: صالح عبدالله
  [VB.NET] مساعدة في استدعاء البيانات معينه من form الأول إلى form 2 بدون التعديل loay775 2 275 18-01-24, 05:04 PM
آخر رد: loay775
  كيف يتم تعبئة قريد فيو بدون قاعدة بيانات بشكل مباشر؟ nowiglah 1 375 01-12-23, 10:57 PM
آخر رد: Taha Okla
  محتاج تعديل على سورس كود - حفظ البيانات بدون قاعدة بيانات new_programer 5 628 30-08-23, 12:21 AM
آخر رد: atefkhalf2004
  [VB.NET] حساب ايام اجازة بدون ايام الجمعة والسبت وعطلات البلد ahmed_king2023 0 453 05-06-23, 03:48 PM
آخر رد: ahmed_king2023
  [سؤال] طباعة تقرير بدون كريستال ريبورت a.ali1509 0 482 01-05-23, 11:22 AM
آخر رد: a.ali1509
  تعديل على كود حفظ بدون تكرار مصمم هاوي 11 1,254 18-03-23, 09:02 AM
آخر رد: مصمم هاوي
  مشكلة استخرج رقم من نص mrfenix93 1 441 01-03-23, 12:29 AM
آخر رد: Taha Okla
  [سؤال] تعبئة الليست بوكس من ال resources ابو روضة 6 666 22-12-22, 01:18 AM
آخر رد: ابو روضة
Exclamation [سؤال] كيف اشغل برنامجي على جميع الفريموروك mudz 41 47,788 20-12-22, 01:20 AM
آخر رد: kebboud

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم