Keyword

Video displayed from Virtuemart URL is not working correctly...

  • Matthew
  • Matthew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 5 months ago #169954 by Matthew
Hello,

I am attempting to stream videos from Amazon s3 via cloudfront. I have set up the files and everything plays fine in a browser...but I'm having problems getting the video player to play correctly from the product description within Virtuemart. I can play the below video just fine in a browser, on an article, etc. However, when the {mp4remote} tag is inserted into some Javascript, it is not playing correctly from the same URL. It is playing from one that is appended by Virtuemart:

Examples:
Here is the mp4remote code (if you just plug in the URL it plays great and you can stop, jump ahead, etc.:
{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Paul+Szych+Training+-+Segment+1.mp4{/mp4remote}


Here is the javascript to load the video if they fall within a 5 day period but the video that ends up outputting is extremely slow and you can't fast forward or even pause the video and play again...:
	if ($results2 != 1) {
			?>[[div class="vid-div" style="width: 100%; float: left;"]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}[[/div]]<?php
		} else {
			
			if ($results3 != "C") {
				echo("[[div style=\"margin: 12px 0; color: red;\"]]Payment Incomplete[[/div]]");
				?>[[div class="vid-div" style="width: 100%; float: left;"]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}[[/div]]<?php
			} else {
				
				if (strtotime("now") > strtotime("+5 days", strtotime($results4))) {
  					echo ("[[div style=\"margin: 12px 0; color: red; font-size: 8pt;\"]]Your 5 Day Subscription Has Expired. Please Purchase Again to Continue Viewing.[[/div]]");
  					?>[[script]]jQuery(".addtocart-button").show();[[/script]][[div class="vid-div" style="width: 100%; float: left;"]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}[[/div]]<?php
				} else {
					?>[[script]]jQuery(".addtocart-button").hide(); jQuery(".course-preview").hide(); jQuery(".product-price").hide();[[/script]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Paul+Szych+Training+-+Segment+1.mp4{/mp4remote}[[script]]jQuery(".avPlayerWrapper").insertBefore(".description-product"); jQuery(".description-product").css({"width": "100%", "padding-top": "24px"}); jQuery(".v-preview").hide(); jQuery(".price").hide();[[/script]]<?php

As you can see it checks to see if the user falls within 5 days of purchase, then lets them view the file. However, the play buttons appended on the receipt page, play from a virtuemart URL that is displaying the video, but not in a streaming capacity, as you can't pause and restart. It simply won't play the video again...

How can I add the video to play correctly with the following URL in the tags so that is plays smoothly and can be stopped, rewind, etc.?: {mp4remote}s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Paul+Szych+Training+-+Segment+1.mp4{/mp4remote}

The ending URL that Virtuemart is pushing the user to is: stophimfromkillingthem.com/index.php?option=com_virtuemart&view=plugin&name=spiral_download&custom_id=2&dlkey=cF9SY0duaUpaVA==&oid=35

The above just won't do because a user can't pause and restart it. Any help is greatly appreciated.

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #169991 by JoomlaWorks
You should probably integrate your mixed PHP/HTML/JS code in an override for AllVideos, so the final output is not processed by Virtuemart. I could help, but I need more context, e.g. where does "$results2" get rendered?

Worse case scenario, use a plugin like www.regularlabs.com/extensions/sourcerer to allow code within your VM product descriptions.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Matthew
  • Matthew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 5 months ago #170006 by Matthew
Fotis,

Thank you so much for helping me. I really appreciate it. Sourcerer is installed already. Here is the entire source for that product:
{source}
	<?php 
		$user = JFactory::getUser();
			
	if($user->id) {
		$db = JFactory::getDbo();
		$query = $db->getQuery(true);
		$query2 = $db->getQuery(true);
		$query3 = $db->getQuery(true);
		$query4 = $db->getQuery(true);
			
		$query->select('virtuemart_order_id')
		->from($db->quoteName('#__virtuemart_orders'))
		->where($db->quoteName('virtuemart_user_id') . ' = ' . $user->id);
			
		$db->setQuery($query);
		$results = $db->loadResult();
		
		$query2->select('virtuemart_product_id')
		->from($db->quoteName('#__virtuemart_order_items'))
		->where($db->quoteName('virtuemart_order_id') . ' = ' . $results);
		
		$db->setQuery($query2);
		$results2 = $db->loadResult();
		
		$query3->select('order_status')
		->from($db->quoteName('#__virtuemart_order_items'))
		->where($db->quoteName('virtuemart_order_id') . ' = ' . $results);
		
		$db->setQuery($query3);
		$results3 = $db->loadResult();
		
		$query4->select('created_on')
		->from($db->quoteName('#__virtuemart_orders'))
		->where($db->quoteName('virtuemart_order_id') . ' = ' . $results);
		
		$db->setQuery($query4);
		$results4 = $db->loadResult();
			
		if ($results2 != 1) {
			?>[[div class="vid-div" style="width: 100%; float: left;"]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}[[/div]]<?php
		} else {
			
			if ($results3 != "C") {
				echo("[[div style=\"margin: 12px 0; color: red;\"]]Payment Incomplete[[/div]]");
				?>[[div class="vid-div" style="width: 100%; float: left;"]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}[[/div]]<?php
			} else {
				
				if (strtotime("now") > strtotime("+5 days", strtotime($results4))) {
  					echo ("[[div style=\"margin: 12px 0; color: red; font-size: 8pt;\"]]Your 5 Day Subscription Has Expired. Please Purchase Again to Continue Viewing.[[/div]]");
  					?>[[script]]jQuery(".addtocart-button").show();[[/script]][[div class="vid-div" style="width: 100%; float: left;"]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}[[/div]]<?php
				} else {
					?>[[script]]jQuery(".addtocart-button").hide(); jQuery(".course-preview").hide(); jQuery(".product-price").hide();[[/script]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Paul+Szych+Training+-+Segment+1.mp4{/mp4remote}[[script]]jQuery(".avPlayerWrapper").insertBefore(".description-product"); jQuery(".description-product").css({"width": "100%", "padding-top": "24px"}); jQuery(".v-preview").hide(); jQuery(".price").hide();[[/script]]<?php
				}
			}
		}
		} else {
			?>[[div class="vid-div" style="width: 100%; float: left;"]]{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}[[/div]]<?php
		}
	?>
{/source}

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #170028 by JoomlaWorks
Why aren't you using proper HTML instead of "[[div..."?

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Matthew
  • Matthew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 5 months ago #170031 by Matthew
I actually didn't write this JS. I'm a noob with JS, and the developer that wrote this is not responding to requests for clarification. What would you recommend changing those to?

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #170040 by JoomlaWorks
The jQuery is just changing the styling (CSS), nothing fancy. There is no JS injecting videos here. Nor altering the output of the videos.

Here's the same code cleaned up and using proper HTML tags (you might want to adjust Sourcerer's options to use < and > for HTML tags instead of and)...
<?php

$user = JFactory::getUser();

if ($user->id) {
    $db = JFactory::getDbo();

    $query = $db->getQuery(true);
    $query2 = $db->getQuery(true);
    $query3 = $db->getQuery(true);
    $query4 = $db->getQuery(true);

    $query->select('virtuemart_order_id')
        ->from($db->quoteName('#__virtuemart_orders'))
        ->where($db->quoteName('virtuemart_user_id') . ' = ' . $user->id);
    $db->setQuery($query);
    $results = $db->loadResult();

    $query2->select('virtuemart_product_id')
        ->from($db->quoteName('#__virtuemart_order_items'))
        ->where($db->quoteName('virtuemart_order_id') . ' = ' . $results);
    $db->setQuery($query2);
    $results2 = $db->loadResult();

    $query3->select('order_status')
        ->from($db->quoteName('#__virtuemart_order_items'))
        ->where($db->quoteName('virtuemart_order_id') . ' = ' . $results);
    $db->setQuery($query3);
    $results3 = $db->loadResult();

    $query4->select('created_on')
        ->from($db->quoteName('#__virtuemart_orders'))
        ->where($db->quoteName('virtuemart_order_id') . ' = ' . $results);
    $db->setQuery($query4);
    $results4 = $db->loadResult();

    if ($results2 != 1) {
?>
<div class="vid-div" style="width:100%;float: left;">
    {mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}
</div>
<?php
    } else {
        if ($results3 != "C") {
?>
<div style="margin:12px 0;color:red;">
    Payment Incomplete
</div>
<div class="vid-div" style="width:100%;float:left;">
    {mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}
</div>
<?php
        } else {
            if (strtotime("now") > strtotime("+5 days", strtotime($results4))) {
?>
<div style="margin:12px 0;color:red;font-size:8pt;">
    Your 5 Day Subscription Has Expired. Please Purchase Again to Continue Viewing.
</div>
<script>jQuery(".addtocart-button").show();</script>
<div class="vid-div" style="width:100%;float:left;">
    {mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}
</div>
<?php
            } else {
?>
<script>
    jQuery(".addtocart-button").hide();
    jQuery(".course-preview").hide();
    jQuery(".product-price").hide();
</script>
{mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Paul+Szych+Training+-+Segment+1.mp4{/mp4remote}
<script>
    jQuery(".avPlayerWrapper").insertBefore(".description-product");
    jQuery(".description-product").css({"width": "100%", "padding-top": "24px"});
    jQuery(".v-preview").hide();
    jQuery(".price").hide();
</script>
<?php
            }
        }
    }
} else {
?>
<div class="vid-div" style="width:100%;float:left;">
    {mp4remote}https://s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Segment+1+Intro.mp4{/mp4remote}
</div>
<?php
}
?>

Since I can't see a page with all these cases obviously and since videos do show up just fine for guests in that site, is the only problem the fact that the videos don't "stream" (e.g. you can't skip forward as you mentioned)? Or do the actual URLs break and the videos are not viewable at all?

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Matthew
  • Matthew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 5 months ago #170054 by Matthew
Oh Wow, I didn't realize that sourcerer was putting out incorrect tags, I thought that was just part of the plugin. LOL THANK YOU so much! However, your cleaned up code did change the order in which the video and button display on the page strangely...Do you know why this would be the case if nothing really changed, just cleaned up code? How can I get them switched back like the other pages?

New Page with your cleaned up code: stophimfromkillingthem.com/advanced-stalking-homicide-avoidance/advanced-stalking-identification

Other pages I would like this one to look like: stophimfromkillingthem.com/advanced-stalking-homicide-avoidance/disruptive-interviews

To answer your last question: The videos are being streamed via Amazon S3 and I have verified that the RTMP link works using their diagnostic tool, and playing just the S3 link shows the streaming video. However, from researching past forum topics, Allvideos doesn't play RTMP streams correct? If that is still the case, do you know why the S3 link by itself "s3-us-west-2.amazonaws.com/paul-szych-videos/UPDATED/Paul+Szych+Training+-+Segment+1.mp4" plays fine, but the appended virtuemart URL ends up not streaming (fast forward, etc.) here: stophimfromkillingthem.com/index.php?option=com_virtuemart&view=plugin&name=spiral_download&custom_id=2&dlkey=cF9FTGI1WVp6aw==&oid=36

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #170058 by JoomlaWorks
The browsers probably understand the format from special headers, despite not using rtmp:// in the URL. However that's probably not the case when using the video URL via AllVideos. Keep in mind you can always try a <video> tag and it might work. The next update of AllVideos will primarily use the <video> tag and fallback to a 3rd party player if required or for formats not supported by the browser directly.

As for your code, I simply formatted what you sent me, so you could see which bit is what. Didn't change any order. If in doubt, simply attach the old file.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Matthew
  • Matthew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 5 months ago #170127 by Matthew
Thank you so much Fotis for your help. I will be on the lookout for the next version of AllVideos.

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #170136 by JoomlaWorks
Sorry I couldn't be of any more help. But rest assured we'll improve this soon.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum