Git Product home page Git Product logo

unity-winrt-wp8-playmovienatively's Introduction

##Play movies natively on WinRT and WP8 from Unity This plugin allows the native playback of movie files on both Windows Phone 8 as well as WinRT.

##Usage

###Play One-Shot Video

WinRT

WinControls.VideoPlayback.PlayVideoFullscreen(string videoUrl, bool controlsEnabled, bool tapSkipsVideo)
  • videoUrl: The URL to the video as a string, including official qualifier (for instance ms-appx:/// for an asset inside the app package or http:// for a web resource).
  • controlsEnabled (default: true): true enables the native video controls (scrubber, play/pause, etc.), false disables them.
  • tapSkipsVideo (default: false): true automatically removes the video element if the user taps/clicks it, false doesn't. If controlsEnabled is set to true and tapSkipsVideo is set to false, a tap/click will pause the video.

Windows Phone 8

WinControls.VideoPlayback.WinControlsWP8.PlayVideoFullscreen(string videoUrl, bool tapSkipsVideo)
  • videoUrl: The URL to the video as a string, including official qualifier.
  • tapSkipsVideo (default: false): true automatically removes the video element if the user taps/clicks it, false doesn't.

###Play using VideoElement Class

Windows Phone

var myNativeVideo = new WinControlsWP8.VideoElement(string videoUrl, bool tapSkipsVideo, bool autoPlay); 
  • videoUrl: The URL to the video as a string, including official qualifier (for instance ms-appx:/// for an asset inside the app package or http:// for a web resource).
  • tapSkipsVideo (default: false): true automatically removes the video element if the user taps/clicks it, false doesn't. If controlsEnabled is set to true and tapSkipsVideo is set to false, a tap/click will pause the video.
  • autoPlay (default false): true automatically starts the video immediatly after creation.
myNativeVideo.Pause();                // Pauses the video
myNativeVideo.Play();                 // Plays the video
myNativeVideo.Stop();                 // Stops the video

bool myNativeVideo.isPlaying          // Is the video playing?
bool myNativeVideo.playbackFinished   // Is the playback finished?
double myNativeVideo.mediaDuration    // Video duration, in seconds (whole and fractions - available after play)

WinRT

var myNativeVideo = new WinControls.VideoElement(string videoUrl, bool controlsEnabled, bool tapSkipsVideo, bool autoPlay); 
  • videoUrl: The URL to the video as a string, including official qualifier (for instance ms-appx:/// for an asset inside the app package or http:// for a web resource).
  • controlsEnabled (default: true): true enables the native video controls (scrubber, play/pause, etc.), false disables them.
  • tapSkipsVideo (default: false): true automatically removes the video element if the user taps/clicks it, false doesn't. If controlsEnabled is set to true and tapSkipsVideo is set to false, a tap/click will pause the video.
  • autoPlay (default false): true automatically starts the video immediatly after creation.
myNativeVideo.Pause();                // Pauses the video
myNativeVideo.Play();                 // Plays the video
myNativeVideo.Stop();                 // Stops the video

bool myNativeVideo.isPlaying          // Is the video playing?
bool myNativeVideo.playbackFinished   // Is the playback finished?
double myNativeVideo.mediaDuration    // Video duration, in seconds (whole and fractions - available after play)

Installation

Copy the contents of the folder CopyContentsToUnityProjectPlugins into the Plugins folder in your Unity project. If it doesn't exist yet, create it.

Windows Phone 8.1

While Windows Phone 8.1 is based on WinRT, Unity does currently not fully support Windows Phone 8.1 (as of May 1st 2014). In theory, the WinRT plugin should work on both Windows Phone 8.1 as well as Xbox One. If you're reading this, Unity has support for WP8.1 and I haven't updated this repo: All source code is in this repo, so changing the #ifdefs as well as putting the plugin into the right subfolder inside plugins should do the trick.

License

While I work at Microsoft, this plugin and all contents are provided as-is without any warranties. For details, please see the attached license (MS-LPL) or http://clrinterop.codeplex.com/license.

unity-winrt-wp8-playmovienatively's People

Stargazers

Media Explorer avatar Joselyn O'Connor avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.