mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	Fix chromecasting regression
This commit is contained in:
		
							parent
							
								
									bceeec849d
								
							
						
					
					
						commit
						aa6a84cdb9
					
				
					 2 changed files with 17 additions and 12 deletions
				
			
		|  | @ -11,6 +11,7 @@ import android.util.Log | |||
| import android.view.* | ||||
| import android.widget.TextView | ||||
| import android.widget.Toast | ||||
| import androidx.annotation.MainThread | ||||
| import androidx.annotation.StringRes | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.appcompat.widget.SearchView | ||||
|  | @ -29,6 +30,7 @@ import org.schabi.newpipe.extractor.NewPipe | |||
| import java.util.* | ||||
| 
 | ||||
| object CommonActivity { | ||||
|     @MainThread | ||||
|     fun Activity?.getCastSession(): CastSession? { | ||||
|         return (this as MainActivity?)?.mSessionManager?.currentCastSession | ||||
|     } | ||||
|  |  | |||
|  | @ -797,18 +797,21 @@ class ResultViewModel2 : ViewModel() { | |||
|         val response = currentResponse ?: return | ||||
|         val eps = currentEpisodes[currentIndex ?: return] ?: return | ||||
| 
 | ||||
|         activity.getCastSession()?.startCast( | ||||
|             response.apiName, | ||||
|             response.isMovie(), | ||||
|             response.name, | ||||
|             response.posterUrl, | ||||
|             result.index, | ||||
|             eps, | ||||
|             links, | ||||
|             subs, | ||||
|             startTime = result.getRealPosition(), | ||||
|             startIndex = startIndex | ||||
|         ) | ||||
|         // Main needed because getCastSession needs to be on main thread | ||||
|         main { | ||||
|             activity.getCastSession()?.startCast( | ||||
|                 response.apiName, | ||||
|                 response.isMovie(), | ||||
|                 response.name, | ||||
|                 response.posterUrl, | ||||
|                 result.index, | ||||
|                 eps, | ||||
|                 links, | ||||
|                 subs, | ||||
|                 startTime = result.getRealPosition(), | ||||
|                 startIndex = startIndex | ||||
|             ) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fun cancelLinks() { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue