-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish: embedded video in-app play. Pending to solve the status bar p…
…roblem.
- Loading branch information
1 parent
9646616
commit b9658b7
Showing
6 changed files
with
109 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
app/src/main/java/com/absolutelycold/axgle/EmbedVideoActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.absolutelycold.axgle; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.content.Intent; | ||
import android.content.res.Configuration; | ||
import android.graphics.Color; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.Window; | ||
import android.view.WindowManager; | ||
import android.webkit.WebChromeClient; | ||
import android.webkit.WebView; | ||
import android.webkit.WebViewClient; | ||
|
||
import java.util.HashMap; | ||
|
||
public class EmbedVideoActivity extends AppCompatActivity { | ||
|
||
private String embeddedUrl; | ||
private WebView webView; | ||
private View decorView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_embed_video); | ||
Intent intent = getIntent(); | ||
embeddedUrl = intent.getStringExtra("embeddedUrl"); | ||
|
||
String frameVideo = "<iframe width=\"100%\" height=\"100%\" src=\"" + embeddedUrl + "\" frameborder=\"0\" allowfullscreen></iframe>"; | ||
|
||
getSupportActionBar().hide(); | ||
decorView = getWindow().getDecorView(); | ||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); | ||
decorView.setBackgroundColor(Color.BLACK); | ||
|
||
webView = findViewById(R.id.embed_video_web_view); | ||
webView.setBackgroundColor(Color.TRANSPARENT); | ||
|
||
|
||
webView.getSettings().setJavaScriptEnabled(true); | ||
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); | ||
webView.getSettings().setSupportMultipleWindows(true); | ||
//webView.setWebViewClient(new WebViewClient()); | ||
webView.setWebChromeClient(new WebChromeClient()); | ||
webView.getSettings().setDomStorageEnabled(true); | ||
webView.loadDataWithBaseURL("https://absolutelycold.github.io", frameVideo, "text/html", null, null); | ||
//webView.loadDataWithBaseURL(null, frameVideo, "text/html", "utf-8", null); | ||
//webView.loadUrl(embeddedUrl, extraHeader); | ||
} | ||
|
||
@Override | ||
protected void onPostResume() { | ||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); | ||
super.onPostResume(); | ||
} | ||
|
||
@Override | ||
public void onWindowFocusChanged(boolean hasFocus) { | ||
super.onWindowFocusChanged(hasFocus); | ||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".EmbedVideoActivity"> | ||
|
||
<WebView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:id="@+id/embed_video_web_view"/> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |