Re: [問題] 如何播放影片?
※ 引述《tuma (tuma)》之銘言:
: 請問一下,C# 不知道有沒有播放影片的 library 可以用呢?
: 我不清楚可不可以用 media player 去放
有managed directx可以用...
: 因為我的程式去讀取影片檔過來,然後動態把資料做一些處理後再放
: 如果能攔截 windows 的 I/O request 是最好,因為這樣就不用自己寫
: media player 了 ><
希望自己在畫格上再做些手腳的,應該不能用底下這樣簡單的放映方法,
請參考 http://www.codeproject.com/cs/media/directshowmediaplayer.asp
要用DirectShow的interop assembly了。
using System;
using System.Threading;
using Microsoft.DirectX.AudioVideoPlayback;
namespace TestVideoPlay
{
class MainClass
{
public static void Main(string[] args)
{
System.Uri uri = new System.Uri(
"http://ezlag.com/files/funny/20050309263FFE4.wmv");
Video video = Video.FromUrl(uri);
try {
video.Play();
while (!video.CurrentPosition.Equals(video.Duration)) {
System.Threading.Thread.Sleep(1000);
}
} finally {
video.Dispose();
}
}
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.222.17.194
討論串 (同標題文章)
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章
20
55