zoukankan      html  css  js  c++  java
  • 实现Windows Phone 8多媒体:视频

    (1)拍摄视频
    拍摄视频和拍摄相片的方法是基本一致的:
    MediaCapture mediaCapture;
    MediaEncodingProfile videoEncodingProperties;
    
    protected override async void OnNavigatedTo(NavigationEventArgs e)
    {
        HardwareButtons.CameraHalfPressed += HardwareButtons_CameraHalfPressed;
        HardwareButtons.CameraReleased += HardwareButtons_CameraReleased;
    
        videoCaptrueElement.Source = await Initialize();
        await mediaCapture.StartPreviewAsync();
    }
    
    async void HardwareButtons_CameraHalfPressed(object sender, CameraEventArgs e)
    {
        if( mediaCapture != null )
        {
            var video = await KnownFolders.VideosLibrary.CreateFileAsync("video.mp4", CreationCollisionOption.GenerateUniqueName);
    await mediaCapture.StartRecordToStorageFileAsync(videoEncodingProperties, video);
        }
    }
    
    async void HardwareButtons_CameraReleased(object sender, CameraEventArgs e)
    {
        if( mediaCapture != null )
        {
            await mediaCapture.StopRecordAsync();
        }
    }
    
    private async Task<MediaCapture> Initialize()
    {
        mediaCapture = new MediaCapture();
        await mediaCapture.InitializeAsync();
    
        mediaCapture.VideoDeviceController.PrimaryUse = CaptureUse.Video;
    
        videoEncodingProperties = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Vga);
    
        return mediaCapture;
    }
    
    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        if( mediaCapture != null )
        {
            mediaCapture.Dispose();
            mediaCapture = null;
        }
    }

    详细说明:http://wp.662p.com/thread-8226-1-1.html

  • 相关阅读:
    Less34-Less37 (宽字节注入)
    宽字节注入 Less32-Less33
    Less29(jspstudy)-Less31
    Less26-Less28a
    Less23-Less25a(24--二次注入)
    Less 11-22
    sqli-labs 1-10
    sqli-labs环境搭建与安装
    OSPF与ACL综合实例
    用分治法完成比赛操作
  • 原文地址:https://www.cnblogs.com/nizhidao/p/3829086.html
Copyright © 2011-2022 走看看