<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=Theora_Event.COMPLETE</id>
	<title>Theora Event.COMPLETE - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=Theora_Event.COMPLETE"/>
	<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Theora_Event.COMPLETE&amp;action=history"/>
	<updated>2026-11-17T12:06:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.gideros.rocks/index.php?title=Theora_Event.COMPLETE&amp;diff=25511&amp;oldid=prev</id>
		<title>MoKaLux: Created page with &quot;&#039;&#039;&#039;Available since:&#039;&#039;&#039; Gideros 2017.10&lt;br/&gt; &#039;&#039;&#039;Value:&#039;&#039;&#039; complete&lt;br/&gt; &#039;&#039;&#039;Defined by:&#039;&#039;&#039; Ogg&lt;br/&gt;  === Description === This event is dispatched by the channel returned by...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Theora_Event.COMPLETE&amp;diff=25511&amp;oldid=prev"/>
		<updated>2026-11-13T22:29:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Available since:&amp;#039;&amp;#039;&amp;#039; Gideros 2017.10&amp;lt;br/&amp;gt; &amp;#039;&amp;#039;&amp;#039;Value:&amp;#039;&amp;#039;&amp;#039; complete&amp;lt;br/&amp;gt; &amp;#039;&amp;#039;&amp;#039;Defined by:&amp;#039;&amp;#039;&amp;#039; &lt;a href=&quot;/index.php/Ogg&quot; title=&quot;Ogg&quot;&gt;Ogg&lt;/a&gt;&amp;lt;br/&amp;gt;  === Description === This event is dispatched by the channel returned by...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Available since:&amp;#039;&amp;#039;&amp;#039; Gideros 2017.10&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Value:&amp;#039;&amp;#039;&amp;#039; complete&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Defined by:&amp;#039;&amp;#039;&amp;#039; [[Ogg]]&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
This event is dispatched by the channel returned by Theora:play() when the stream reaches its end. With looping enabled the stream restarts instead of finishing.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
	local ok, err = pcall(function()&lt;br /&gt;
		local channel = videoSource:play(0, looping)&lt;br /&gt;
		videoChannel = channel&lt;br /&gt;
		readLength()&lt;br /&gt;
&lt;br /&gt;
		local info&lt;br /&gt;
		if theoraCore then&lt;br /&gt;
			info = theoraCore.getVideoInfo(channel:getStreamId())&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if info then&lt;br /&gt;
			-- Fit the video inside the card, keeping its aspect ratio.&lt;br /&gt;
			local maxW, maxH = VIDEO_W - VIDEO_PAD * 2, VIDEO_H - VIDEO_PAD * 2&lt;br /&gt;
			local scale = math.min(maxW / info.width, maxH / info.height)&lt;br /&gt;
			local w = math.floor(info.width * scale)&lt;br /&gt;
			local h = math.floor(info.height * scale)&lt;br /&gt;
&lt;br /&gt;
			videoMesh = channel:getVideo(w, h)&lt;br /&gt;
			videoMesh:setPosition(&lt;br /&gt;
				math.floor(VIDEO_X + (VIDEO_W - w) / 2),&lt;br /&gt;
				math.floor(VIDEO_Y + (VIDEO_H - h) / 2))&lt;br /&gt;
			videoMesh:addEventListener(Event.TOUCHES_BEGIN, function()&lt;br /&gt;
				togglePlay()&lt;br /&gt;
				return true&lt;br /&gt;
			end)&lt;br /&gt;
			videoLayer:addChild(videoMesh)&lt;br /&gt;
&lt;br /&gt;
			local parts = { string.format(&amp;quot;%d x %d&amp;quot;, info.width, info.height) }&lt;br /&gt;
			if info.fps then&lt;br /&gt;
				table.insert(parts, string.format(&amp;quot;%d fps&amp;quot;, math.floor(info.fps + 0.5)))&lt;br /&gt;
			end&lt;br /&gt;
			if videoLength &amp;gt; 0 then&lt;br /&gt;
				table.insert(parts, string.format(&amp;quot;%.1f s&amp;quot;, videoLength / 1000))&lt;br /&gt;
			end&lt;br /&gt;
			metaLabel:setText(table.concat(parts, &amp;quot;   &amp;quot;))&lt;br /&gt;
			centerX(metaLabel, 334)&lt;br /&gt;
&lt;br /&gt;
			print(&amp;quot;[theora] playing&amp;quot;, VIDEO_PATH,&lt;br /&gt;
				info.width .. &amp;quot;x&amp;quot; .. info.height,&lt;br /&gt;
				&amp;quot;fps=&amp;quot; .. tostring(info.fps),&lt;br /&gt;
				&amp;quot;length=&amp;quot; .. tostring(videoLength))&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		channel:addEventListener(Event.COMPLETE, function()&lt;br /&gt;
			if videoChannel == channel then&lt;br /&gt;
				fallbackState = &amp;quot;Finished&amp;quot;&lt;br /&gt;
				refreshPlayButton()&lt;br /&gt;
				refreshStatus()&lt;br /&gt;
			end&lt;br /&gt;
		end)&lt;br /&gt;
	end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Ogg}}&lt;/div&gt;</summary>
		<author><name>MoKaLux</name></author>
	</entry>
</feed>