# Play movie based on Observable

**URL:** <https://forums.fusetools.com/t/play-movie-based-on-observable/2391>\
**Category:** How-to Discussions\
**Created:** [October 19, 2017, 5:30pm UTC](https://forums.fusetools.com/t/play-movie-based-on-observable/2391 "2017-10-19T17:30:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@Nicolas](https://forums.fusetools.com/u/Nicolas)\
**Post date:** [October 19, 2017, 5:30pm UTC](https://forums.fusetools.com/t/play-movie-based-on-observable/2391/1 "2017-10-19T17:30:35Z")

</div>

Hi,

Since the upgrade to 1.3 my splash movie doesn’t start anymore. I’m trying to play a movie on the splash page when Observable {playVideo} is true. When this is true I only see the beginning of the movie so it doesn’t play but it’s visible.

```auto
		<Video ux:Name="splashLogo" Layer="Background" File="../../assets/splash.mp4" IsLooping="true" AutoPlay="false" Visibility="Hidden">
			<WhileCompleted>
				<JavaScript>
					router.goto("home");
				</JavaScript> 
			</WhileCompleted>
		</Video>

	    <WhileTrue Value="{playVideo}">
	        <Change Target="splashLogo.Visibility" Value="Visible" />
	        <Play Target="splashLogo" Delay="0.2" />
	    </WhileTrue>	
	    <WhileFalse Value="{playVideo}">  
	        <Change Target="splashLogo.Visibility" Value="Hidden" />
	        <Stop Target="splashLogo" />
	    </WhileFalse>

```

---

<div class="post-metadata">

**Author:** ![petterroea](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/petterroea/32/438_2.png) [@petterroea](https://forums.fusetools.com/u/petterroea)\
**Post date:** [October 19, 2017, 6:43pm UTC](https://forums.fusetools.com/t/play-movie-based-on-observable/2391/2 "2017-10-19T18:43:46Z")

</div>

Hey

Changing AutoPlay to `true` solves this issue, is there any reason why you explicitly disabled it?

---

<div class="post-metadata">

**Author:** ![Nicolas](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@Nicolas](https://forums.fusetools.com/u/Nicolas)\
**Post date:** [October 19, 2017, 7:19pm UTC](https://forums.fusetools.com/t/play-movie-based-on-observable/2391/3 "2017-10-19T19:19:55Z")

</div>

Liam,

The movie plays with AutoPlay=“true” but with Javascript I do a check on startup if the movie should play or not (based on last visit) and if it shouldn’t play I’ll still hear the first 1-2 seconds of the movie just before going to the main page. See javascript below.

```auto
var Observable = require("FuseJS/Observable");
var Storage = require('FuseJS/Storage');
var playVideo = Observable(false);

var obj;
Storage.read("settings.json").then(function(content) {
	obj = JSON.parse(content);
	obj.last_visit = Date.now();
	if(minutes > 5) {
		playVideo.value = true;			
		obj.last_splashscreen = Date.now();
		Storage.write("settings.json", JSON.stringify(obj));
	} else {
		playVideo.value = false;			
		Storage.write("settings.json", JSON.stringify(obj));
		router.goto("home");
	}
}, function(error) {
	obj = {last_visit: Date.now(), last_splashscreen: Date.now()};
	Storage.write("settings.json", JSON.stringify(obj));
	playVideo.value = true;
});

module.exports = {
	playVideo	: playVideo
};

```
