WinRT Background Audio - windows-runtime

I am going for a most simplistic playback of background audio. I don't even want to capture media controls or anything. I just want to start the app and play audio until I explicitly close it. That is, it should play audio while hidden.
I used this article and this question as reference and I followed their guidance:
<MediaElement Name="someMedia"
AudioCategory="BackgroundCapableMedia"
IsLooping="True"
Source="Assets/some.mp3"
AutoPlay="true"/>
Also, I added Background Tasks to my Package.appxmanifest's Declarations, checked Audio and set the start page. What am I missing?

You should also enable SystemMediaTransportControls and handle two events on it and on your MediaElement to keep them in sync.
Check this article:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj841209.aspx

Related

How does html5 video tag works? Is there any way to see how it is implemented

I am developing an application where I need to display some animation in the canvas along with the video as a separate element, for the same I need to maintain the synchronisation between two DOM elements very precisely.
I was thinking of playing the animation as video tag plays the video. Is there any way I could see how the html5 video tag is implemented?
Theoretically, each browser can have their own implementation of the video tag. Besides of that, they will try their best to follow some rules specified by w3.org
This is the video tag draft:
https://www.w3.org/TR/2011/WD-html5-20110113/video.html#video
If yout want to sync something with a video you will want to use some video tag events:
https://www.w3.org/2010/05/video/mediaevents.html
A timeupdate event listener can be set on the video which will allow you to synchronize other elements on the page with the video as it plays. Video elements have many other events in addition to timeupdate, such as play, pause, and seeking.
The implementation of video elements will differ depending on the browser and may not be completely public, such as how they work with DRM.

Audioless video accessibility and autoplay/loop

I have an audioless video implemented using HTML5's <video> tag. I'm trying to find out if auto-playing the video and automatically looping it (assuming I add a button to remove loop as well) would cause accessibility issues? I know there are rules regarding audio as well as video with audio that prevent you from doing that, so I'm also wondering if this video is practically considered a GIF.
The video can be found here for reference:
http://www.med.uottawa.ca/bmi/eng/lee.html
This is technically an accessibility violation if it plays for more than 5 seconds. It affects users with disabilities such as attention deficit disorder. You need to provide a button to stop the video from playing immediately, not only a button that disables the automatic loop.

How can I prevent HTML5 audio or video from playing when removed from the page?

Please feel free to suggest a better title for this post, as I wasn't sure how to properly describe the problem in one short question.
I've got a media player page with an HTML5 player and the option for the visitor to choose to play the video or audio for that page. While one is playing, a button to switch to the other is available. For example, if the visitor is playing audio, a "Switch to Video" button is available, which essentially removes the current content and replaces it. This effectively removes the current HTML5 player from the DOM tree as well, of course. In addition to replacing the content, a 'pause' event is triggered on any audio or video element on the page prior to loading the new content.
Unfortunately, if you switch between audio and video quickly enough, you'll end up with multiple items playing simultaneously.
I need to make sure this doesn't happen.
How can I ensure that when I replace the player, the previously loading file does not play?
To see this happening, go to http://www.onlinechurchmediacenter.com/mc/vertigoelectric/5628, choose either audio or video, and once it starts playing keep clicking the "Play Audio" or "Play Video" link which appears below the player. If you continuously click this quickly enough, you'll begin to notice multiple instances of the audio/video playing over each other.
I'd advise not to remove the elements from the DOM. Just hide them and trigger the pause. For good measure, trigger another pause before you play the next item.

Html5 video overlay architecture

I want to create a html5 page with video and an image overlay - meaning some image that is showing over the video. This overlay will in time also be text in some cases. Is there any good way to achieve this?
What I've been trying this far is to use a <video> tag to hold the video, and draw the image into a canvas, which I place on top of the video. To show it I need to move the video back setting z-index to -1, but then the video controls won't work. Maybe there's a solution to make the controls work again, but I'm not sure if I'm on the right path here.. I am assuming there is a recommended solution to this. Maybe using a canvas which I fill both video and overlay into. Or something completely different?
Note: I edited the question as it originally pointed in the wrong direction regarding what was important here. I'd love to have a solution which makes this work seamlessly in fullscreen and everything, but the focus is: What is the appropriate way to place items on top of video - in html5?
Achieving what you want and have it supported in out-of-the-box fullscreen is problematic. Fullscreen support in html5 video is only optional and in any way not accesible thorugh the API (See discussion here).
Even if you used the built in fullscreen there is no way you could inject content above it unless you are willing to change the video file itself on the server in runtime.
what you can do however (And what I did in a similar case) is to implement your own video controls, run the video tag without the built in controls, and have fun with overlaying as many layers as you want on top of your now out of focus video.
As for fullscreen, you can implement some sort of custom background fullscreen similar to what's been done here
edit: The problem you're having by placing a canvas over the video is blocking the built in html video controls. My suggestion is to implement your own video controls (play, pause, volume, seeker, etc.) using html and javascript calling the video API. You can probably even make it prettier then the ugly built in controls.
Your controls can be contained in a layer above the overlaid canvas, and thus the video will be shown, above it the overlay and above it your control set.
You can read a little about implementing your own controls here or here
And anyway this can easily be much better than this.

iOS HTML5 video player next/prev buttons

Is there a way to access/listen to the previous/next buttons in the iOS HTML5 video player? Ideally I would listen to some sort of a prev and next event and swap out the videos accordingly without the user having to close the video and click my prev/next buttons.
(source: iphonefaq.org)
I am currently using jwplayer to generate the html5 video and listening to their playlist next/prev listeners don't seem to do the trick. I can always find and attach listeners to the actual <video> tag pretty easily though.
If you attach listeners to the video tag itself then when the user hits next and previous then the listeners in the code will put up on those buttons. I am doing something similar with youTube videos. If you hit next it goes to the end of the youtube video and fires a video complete event tag and then I load the next video when that is called, so that the video will one loop without the next button and two the users can hit the buttons. I have not found a way to monitor the buttons in the player on the iphone side, but if I find it I will post that as well since it is important to know both angels if possible.
Funny thing I think I am looking to try and do the same exact thing. I know how to transition the videos to the next without having to leave the fullscreen mode because of using youTube api in the js but I am not able to observe the quicktime player itself and need to for another feature that I would like to work on.
That's the native iOS player which is a thin version of Quicktime. You'll know if it's an HTML5 player when it doesn't transition from the Quicktime player and your page in Safari. How is your movie being embedded?
I recently had a similar problem and was unable to find a solution using the HTML player. I ended up implementing the video player using MPVideoPlayer Framework and launching it from my web view with a custom URL scheme (AppName:Commnad:Asset). I was then able to use the delegate methods to monitor user interactions. If you would like to see basic implementation, let me know and I can add some code.